Dear Fletch,
Thanks for the reply.
... the program is checking if it's stdout is a TTY or not and behaving differently based upon that.
But, the strange thing in my setting is that one parameter ('A') works well, but not the other ('B')?
From what I understand of your statement above, under both parameters the system call should fail. Please correct me if I'm wrong.
You could check by using your shell to redirect the output into a file and see if it behaves similarly.
Actually it runs under CGI script. And following your suggestion, I did pass the output into a file using standard open file handle.
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
use Data::Dumper;
use Carp;
print header();
my $param = 'A'; # or otherwise not working 'B'
my $OUTFILE_file_name = 'out.txt';
@output = `some_binary.out $param`;
chomp output;
open ( OUTFILE, '>', $OUTFILE_file_name )
or croak "$0 : failed to open $OUTFILE_file_name : $!\n";
print OUTFILE Dumper \@output;
close ( OUTFILE );
But the out.txt shows nothing, i.e it gives: $VAR1=[];
---
neversaint and everlastingly indebted.......
| [reply] [d/l] [select] |
if( $ARGV[0] eq 'A' ) {
print "I work for a TTY only\n" if -t STDOUT;
}
if( $ARGV[0] eq 'B' ) {
print "I work regardless of TTY-ness of STDOUT\n";
}
Having said that, one possibly might not call that "expected" behaviour (and if it were the case one would certainly be reasonable in expecting it to be documented). I was just tossing it out as something to be aware of.
| [reply] [d/l] |
You appear to be saying that you get different output from the executable when you run it as a cgi, ie. with web server account privileges, than you get when you run it from the command line, ie. when it has your userid privileges.
It's quite common for web server account privileges to be severly restricted. Indeed, if they are not, your web server is likely vulnerable.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |