[Process] Fix #5594 : termsig must be used instead of stopsig in exceptions when a process is signaled

This commit is contained in:
Romain Neutron 2013-04-27 20:16:01 +02:00
parent 9abcf4f81b
commit 8757ad45a8

View File

@ -398,7 +398,10 @@ class Process
} }
$this->updateStatus(); $this->updateStatus();
if ($this->processInformation['signaled']) { if ($this->processInformation['signaled']) {
throw new \RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig'])); if ($this->isSigchildEnabled()) {
throw new RuntimeException('The process has been signaled.');
}
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
} }
$time = 0; $time = 0;
@ -410,7 +413,10 @@ class Process
$exitcode = proc_close($this->process); $exitcode = proc_close($this->process);
if ($this->processInformation['signaled']) { if ($this->processInformation['signaled']) {
throw new \RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig'])); if ($this->isSigchildEnabled()) {
throw new RuntimeException('The process has been signaled.');
}
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
} }
$this->exitcode = $this->processInformation['running'] ? $exitcode : $this->processInformation['exitcode']; $this->exitcode = $this->processInformation['running'] ? $exitcode : $this->processInformation['exitcode'];