Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/ExecFuture.php
Show First 20 Lines • Show All 746 Lines • ▼ Show 20 Lines | if (!$status['running']) { | ||||
// consider the subprocess to have exited until we've read everything. | // consider the subprocess to have exited until we've read everything. | ||||
// See T9724 for context. | // See T9724 for context. | ||||
if (feof($stdout) && feof($stderr)) { | if (feof($stdout) && feof($stderr)) { | ||||
$is_done = true; | $is_done = true; | ||||
} | } | ||||
} | } | ||||
if ($is_done) { | if ($is_done) { | ||||
$signal_info = null; | |||||
// If the subprocess got nuked with `kill -9`, we get a -1 exitcode. | // If the subprocess got nuked with `kill -9`, we get a -1 exitcode. | ||||
// Upgrade this to a slightly more informative value by examining the | // Upgrade this to a slightly more informative value by examining the | ||||
// terminating signal code. | // terminating signal code. | ||||
$err = $status['exitcode']; | $err = $status['exitcode']; | ||||
if ($err == -1) { | if ($err == -1) { | ||||
if ($status['signaled']) { | if ($status['signaled']) { | ||||
$err = 128 + $status['termsig']; | $signo = $status['termsig']; | ||||
$err = 128 + $signo; | |||||
$signal_info = pht( | |||||
"<Process was terminated by signal %s (%d).>\n\n", | |||||
phutil_get_signal_name($signo), | |||||
$signo); | |||||
} | } | ||||
} | } | ||||
$result = array( | $result = array( | ||||
$err, | $err, | ||||
$this->stdout, | $this->stdout, | ||||
$this->stderr, | $signal_info.$this->stderr, | ||||
); | ); | ||||
$this->setResult($result); | $this->setResult($result); | ||||
$this->closeProcess(); | $this->closeProcess(); | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 184 Lines • Show Last 20 Lines |