Author Topic: Use xfce4-terminal to launch console programs  (Read 6215 times)

Offline clyfish

  • Multiple posting newcomer
  • *
  • Posts: 26
Use xfce4-terminal to launch console programs
« on: May 06, 2007, 02:51:45 pm »
Code
xfce4-terminal -T 'test' -e 'LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH /usr/bin/cb_console_runner "/home/cly/CB_Projects/test/bin/Debug/test" '
This doesn't work, because xfce4-terminal try to excute a program named "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH".
And if I delete the "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH", it's behavior is correct.
Code
xfce4-terminal -T 'test' -e '/usr/bin/cb_console_runner "/home/cly/CB_Projects/test/bin/Debug/test" '

But I can't find where to set it in codeblocks,
so I wrote a perl wrapper, and set [Terminal to launch console program](Setting -> Environment -> General setting) to "/home/cly/.codeblocks/xfce4-terminal.cly -T $TITLE -e ".
(Note the blank after "-e")

the ugly script(it's more like a c program)
Code
#!/usr/bin/perl -w

while ($arg = shift(@ARGV)) {
if ($arg eq '-e') {
@cmd = split(' ', shift(@ARGV));
for ($i = 0; $i < @cmd; ++$i) {
if (!($cmd[$i] =~ /=/)) {
last;
}
}
$tmp = "";
for ( ; $i < @cmd; ++$i) {
$tmp .= " " . $cmd[$i];
}
push(@args, '-e', $tmp);
}
else {
push(@args, $arg);
}
}
exec("xfce4-terminal", @args);

Is there a better way to use xfce4-terminal with codeblocks?

Offline sasq

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Use xfce4-terminal to launch console programs
« Reply #1 on: August 14, 2007, 06:03:59 pm »
Same here, with aterm. Any solutions?

nmtservice

  • Guest
Re: Use xfce4-terminal to launch console programs
« Reply #2 on: September 21, 2007, 09:42:13 pm »
Maybe this will cause a lot of unrelated issues, but I suggest you to change -e  with eXecute switch -x :)
« Last Edit: September 21, 2007, 09:49:11 pm by nmtservice »