Page MenuHomePhabricator

D17354.diff
No OneTemporary

D17354.diff

diff --git a/src/future/exec/ExecFuture.php b/src/future/exec/ExecFuture.php
--- a/src/future/exec/ExecFuture.php
+++ b/src/future/exec/ExecFuture.php
@@ -426,7 +426,10 @@
public function resolveKill() {
if (!$this->result) {
$signal = 9;
- proc_terminate($this->proc, $signal);
+
+ if ($this->proc) {
+ proc_terminate($this->proc, $signal);
+ }
$this->result = array(
128 + $signal,
diff --git a/src/future/exec/__tests__/ExecFutureTestCase.php b/src/future/exec/__tests__/ExecFutureTestCase.php
--- a/src/future/exec/__tests__/ExecFutureTestCase.php
+++ b/src/future/exec/__tests__/ExecFutureTestCase.php
@@ -63,6 +63,14 @@
$future->resolve();
}
+ public function testTerminateWithoutStart() {
+ // We never start this future, but it should be fine to kill a future from
+ // any state.
+ $future = new ExecFuture('sleep 1');
+ $future->resolveKill();
+
+ $this->assertTrue(true);
+ }
public function testTimeoutTestShouldRunLessThan1Sec() {
// NOTE: This is partly testing that we choose appropriate select wait

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 10:31 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277813
Default Alt Text
D17354.diff (1 KB)

Event Timeline