in reply to How to trick this program (weird catch-the-output problem)?

It seems that bsub somehow finds out that its standard error is not connected to a terminal, and then refuses to print the message.
Can you check this theory by running bsub -k > some-file 2>&1 from the command line? If the error message shows up in some-file then that would be a work-around.

Another option is to check $? to see if bsub exited with a 0 status. Commands usually exit with a non-zero status when there is an error condition. This won't get you the output, but at least you can tell if there was a problem:

my $output = qx("$command 2>&1"); if ($?) { # something wrong }

Replies are listed 'Best First'.
Re^2: How to trick this program (weird catch-the-output problem)?
by rovf (Priest) on May 05, 2008 at 10:18 UTC
    Good point. I tried
    bsub -k >a 2>&1
    and, indeed, a turns out to be empty. This means that bsub really behaves differently, when it sees that it is not connected to a terminal.
    Ronald Fischer <ynnor@mm.st>