Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15396987
D17354.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17354.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 5:24 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7611813
Default Alt Text
D17354.diff (1 KB)
Attached To
Mode
D17354: Fix an issue where resolveKill() emits a warning if the future was never started
Attached
Detach File
Event Timeline
Log In to Comment