Now consider the case when $parameters happens to be a parameter which bsub doesn't like. For example, the call (on the Win/Unix) command line$command="bsub $parameters" # 3rd party program ... $output=qx($command 2>&1); # Works also under Win
happens to be illegal because of the -k switch. Not surprisingly, bsub complains:bsub -k
Now to the strange part: If I do the same under Perl, i.e.bsub: option requires an argument -- k Usage: bsub ....
my $output is empty - this happens under Unix and Windows the same. It seems that bsub somehow finds out that its standard error is not connected to a terminal, and then refuses to print the message.$parameters='-k' ... $command="bsub $parameters" # 3rd party program ... $output=qx($command 2>&1); # Works also under Win
Is my guess likely correct, or are there other possibilities which could explain this behaviour?
And: Is it possible to fool a program (such as bsub) into thinking that it is connected to a terminal, although it is called via backticks from Perl? I guess there is indeed no workaround possible, but just wanted to make sure that I didn't miss something...
Ronald
In reply to How to trick this program (weird catch-the-output problem)? by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |