After consulting$ echo Hello >t1.txt $ echo World >t2.txt $ perl -wle " $ret = system q[diff -u t1.txt t2.txt >NUL 2>&1] ; print + $ret; print $?" 256 256 $ perl -Mautodie=system -wle " $ret = system q[diff -u t1.txt t2.txt > +NUL 2>&1] ; print $ret; print $?" "diff -u t1.txt t2.txt >NUL 2>&1" unexpectedly returned exit value 1 a +t (eval 10) line 13 at -e line 1 $ perl -MIPC::System::Simple=system -wle " $ret = system q[diff -u t1. +txt t2.txt >NUL 2>&1] ; print $ret; print $?" "diff -u t1.txt t2.txt >NUL 2>&1" unexpectedly returned exit value 1 a +t -e line 1
and some docs, you don't need eval, you could write$ diff --help |grep -i exit Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
[0, 1] are acceptable exit value, any others and IPC::System::Simple will croak$ perl -MIPC::System::Simple=system -wle " $ret = system [0,1], q[diff + -u t1.txt t2.txt >NUL 2>&1] ; print $ret; print $?" 1 256 $ perl -Mautodie=system -wle " $ret = system [0,1], q[diff -u t1.txt t +2.txt >NUL 2>&1] ; print $ret; print $?" 1 256
In reply to Re: [Win32] Successful system() call returns 256
by Anonymous Monk
in thread [Win32] Successful system() call returns 256
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |