rovf has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to trick this program (weird catch-the-output problem)?
by mscharrer (Hermit) on Apr 30, 2008 at 13:49 UTC | |
|
Re: How to trick this program (weird catch-the-output problem)?
by pc88mxer (Vicar) on Apr 30, 2008 at 14:22 UTC | |
by rovf (Priest) on May 05, 2008 at 10:18 UTC | |
|
Re: How to trick this program (weird catch-the-output problem)?
by alexm (Chaplain) on Apr 30, 2008 at 15:09 UTC | |
|
Re: How to trick this program (weird catch-the-output problem)?
by almut (Canon) on Apr 30, 2008 at 16:31 UTC | |
by rovf (Priest) on May 05, 2008 at 10:59 UTC | |
|
Re: How to trick this program (weird catch-the-output problem)?
by chrism01 (Friar) on May 01, 2008 at 00:45 UTC |