We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b20231a commit 20c54bbCopy full SHA for 20c54bb
2 files changed
src/Process.php
@@ -181,6 +181,10 @@ public function close()
181
*/
182
public function terminate($signal = null)
183
{
184
+ if ($this->process === null) {
185
+ return false;
186
+ }
187
+
188
if ($signal !== null) {
189
return proc_terminate($this->process, $signal);
190
}
tests/AbstractProcessTest.php
@@ -284,6 +284,13 @@ public function testStartAlreadyRunningProcess()
284
$process->start($this->createLoop());
285
286
287
+ public function testTerminateProcesWithoutStartingReturnsFalse()
288
+ {
289
+ $process = new Process('sleep 1');
290
291
+ $this->assertFalse($process->terminate());
292
293
294
public function testTerminateWithDefaultTermSignalUsingEventLoop()
295
296
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
0 commit comments