B
bernd
Hello netties,
I try to run a simple UNIX-command using IPC:
pen and want to get the
command line's STDOUT, STDERR and the return code of the command using
the following:
cat script.pl
#!/usr/bin/perl
#
use IPC::Open3;
open3 (\*WRT, \*OUT, \*ERR, "ls -ly ; echo $?") or print "Could not
run unix-cmd\n";
@OUT = <OUT> ;
@ERR = <ERR>;
print "### OUT ###\n";
foreach ( @OUT ) { print "$_\n" } ;
print "### ERR ###\n" ;
foreach ( @ERR ) { print "$_\n" }
script.pl
### OUT ###
0
### ERR ###
ls: illegal option -- y
Usage: ls [-aAbcCdDfFgilLmnopqrRstux1] [file ... | directory ...]
On the command line "ls -ly" has the return code 2, run from within
perl I get 0.
What goes wrong?
Cheers
Bernd
I try to run a simple UNIX-command using IPC:
command line's STDOUT, STDERR and the return code of the command using
the following:
cat script.pl
#!/usr/bin/perl
#
use IPC::Open3;
open3 (\*WRT, \*OUT, \*ERR, "ls -ly ; echo $?") or print "Could not
run unix-cmd\n";
@OUT = <OUT> ;
@ERR = <ERR>;
print "### OUT ###\n";
foreach ( @OUT ) { print "$_\n" } ;
print "### ERR ###\n" ;
foreach ( @ERR ) { print "$_\n" }
script.pl
### OUT ###
0
### ERR ###
ls: illegal option -- y
Usage: ls [-aAbcCdDfFgilLmnopqrRstux1] [file ... | directory ...]
On the command line "ls -ly" has the return code 2, run from within
perl I get 0.
What goes wrong?
Cheers
Bernd