diff options
author | Maarten Vanraes <alien@mageia.org> | 2016-03-20 10:21:28 +0100 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2016-04-24 23:20:34 +0200 |
commit | c7ea22b0e9c959e77a19e728ba738cb91bca103d (patch) | |
tree | 80c7b9fd708c09198822f55efcd734cc73f19656 /lib | |
parent | 6864350eb27e4ad08cbb534f49b3f9c9402319de (diff) | |
download | manatools-c7ea22b0e9c959e77a19e728ba738cb91bca103d.tar manatools-c7ea22b0e9c959e77a19e728ba738cb91bca103d.tar.gz manatools-c7ea22b0e9c959e77a19e728ba738cb91bca103d.tar.bz2 manatools-c7ea22b0e9c959e77a19e728ba738cb91bca103d.tar.xz manatools-c7ea22b0e9c959e77a19e728ba738cb91bca103d.zip |
RunProgram: allow to return exitcode of the program
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ManaTools/Shared/RunProgram.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/RunProgram.pm b/lib/ManaTools/Shared/RunProgram.pm index dc8c1fe4..1b60652c 100644 --- a/lib/ManaTools/Shared/RunProgram.pm +++ b/lib/ManaTools/Shared/RunProgram.pm @@ -186,6 +186,8 @@ make sure environment is set right and keep a copy of the X11 cookie =item * B<timeout>: execution of $name will be aborted after C<timeout> seconds +=item * B<exitcode>: function will return the exit code of the process + =back eg: @@ -327,8 +329,10 @@ sub raw { } : do { exec $name, @args; }; + my $exitcode = $!; + return $exitcode if $options->{exitcode}; if (!$ok) { - _die_exit("exec of $real_name failed: $!"); + _die_exit("exec of $real_name failed: $exitcode"); } } |