From f95330595052259b066bd8ce44ce85e07d73209e Mon Sep 17 00:00:00 2001 From: techno-express Date: Sat, 22 May 2021 13:25:53 -0400 Subject: [PATCH] future status should not change on `close()` or `stop()`, and tests corrections --- Spawn/Future.php | 2 +- tests/SpawnTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Spawn/Future.php b/Spawn/Future.php index cf17fe3..672e23d 100644 --- a/Spawn/Future.php +++ b/Spawn/Future.php @@ -166,7 +166,6 @@ public function close() $this->processOutput = null; $this->processError = null; $this->process = null; - $this->status = null; $this->task = null; $this->signal = null; unset($this->messages); @@ -488,6 +487,7 @@ public function stop(int $signal = \SIGKILL): FutureInterface $this->process->stop(0, $signal); } + $this->status = false; return $this; } diff --git a/tests/SpawnTest.php b/tests/SpawnTest.php index 0e5cd55..1c3060e 100644 --- a/tests/SpawnTest.php +++ b/tests/SpawnTest.php @@ -252,7 +252,7 @@ public function testSignal() }); $future->stop(); - $this->assertTrue($future->isRunning()); + $this->assertFalse($future->isRunning()); $future->run(); $this->assertFalse($future->isRunning()); $this->assertFalse($future->isSuccessful()); @@ -273,7 +273,7 @@ public function testSignalYield() }); $future->stop(); - $this->assertTrue($future->isRunning()); + $this->assertFalse($future->isRunning()); $yield = $future->yielding(); $this->assertTrue($yield instanceof \Generator); $this->assertNull($yield->current());