Преглед изворни кода

Dpkg::IPC: Add nocheck option to wait_child()

* scripts/Dpkg/IPC.pm (wait_child): Add nocheck option to not
check the return status of the child process.
Raphael Hertzog пре 18 година
родитељ
комит
ba4236b5b0
1 измењених фајлова са 11 додато и 2 уклоњено
  1. 11 2
      scripts/Dpkg/IPC.pm

+ 11 - 2
scripts/Dpkg/IPC.pm

@@ -238,7 +238,8 @@ sub fork_and_exec {
 
 Takes as first argument the pid of the process to wait for.
 Remaining arguments are taken as a hash of options. Returns
-nothing.
+nothing. Fails if the child has been ended by a signal or
+if it exited non-zero.
 
 Options:
 
@@ -249,6 +250,12 @@ Options:
 String to identify the child process in error messages.
 Defaults to "child process".
 
+=item nocheck
+
+If true do not check the return status of the child (and thus
+do not fail it it has been killed or if it exited with a
+non-zero return code).
+
 =back
 
 =cut
@@ -258,7 +265,9 @@ sub wait_child {
     $opts{"cmdline"} ||= _g("child process");
     error(_g("no PID set, cannot wait end of process")) unless $pid;
     $pid == waitpid($pid, 0) or syserr(_g("wait for %s"), $opts{"cmdline"});
-    subprocerr($opts{"cmdline"}) if $?;
+    unless ($opts{"nocheck"}) {
+	subprocerr($opts{"cmdline"}) if $?;
+    }
 }
 
 1;