in reply to Re: vanishing system call
in thread vanishing system call
It seems this is a meme that just won't roll over and die...
The construct, system(...) or die_warn_etc() is almost never what you want. The return value of system() is the exit value of the command executed. Usually, this will be 0 on success. Some alternatives:
system(...) and die; # Ugly. if ( system(...) != 0 ) { die } # C-ish if ( system(...) ) { die } # C-ish and ugly. unless ( system(...) == 0 ) { die } # Nicer
I think it is better to explicitly compare to 0. It serves as a reminder that system() is a bit different than most functions in this respect.
-sauoq "My two cents aren't worth a dime.";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: vanishing system call
by Aristotle (Chancellor) on Sep 21, 2002 at 09:48 UTC |