in reply to "System" will not run an executable
If you're in +n.x you can find this with:
which nzbget
let's say it tells you it's in /usr/local/bin/nzbget you would modify your code to be:
The $! is *very* useful to help you here because it will tell you the system error that is being thrown to tell you why the command is failing.my @args = ("/usr/local/bin/nzbget", $item); system(@args) == 0 or die "Could not run '@args' ($?): $!\n";
The ($?) will show you the return code that the program failed with (in case there was nothing useful in $!).
Watch out for the fact that system is a little different from other functions that you expect to return 1 on success such as open:
If you read system you will see that this is based around the fact that a program exiting successfully normally returns 0 (and system() does special magic on the return code to give you more useful info wrapped up in one number)my $args = "/usr/local/bin/nzbget $item" open("$args |") || die "Can't run '$args': $!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "System" will not run an executable
by jonadab (Parson) on Dec 04, 2005 at 22:02 UTC |