Page MenuHomePhabricator

D7688.diff
No OneTemporary

D7688.diff

Index: src/future/exec/ExecFuture.php
===================================================================
--- src/future/exec/ExecFuture.php
+++ src/future/exec/ExecFuture.php
@@ -400,18 +400,20 @@
* @task resolve
*/
public function resolveKill() {
- if (defined('SIGKILL')) {
- $signal = SIGKILL;
- } else {
- $signal = 9;
- }
+ if (!$this->result) {
+ if (defined('SIGKILL')) {
+ $signal = SIGKILL;
+ } else {
+ $signal = 9;
+ }
- proc_terminate($this->proc, $signal);
- $this->result = array(
- 128 + $signal,
- $this->stdout,
- $this->stderr);
- $this->closeProcess();
+ proc_terminate($this->proc, $signal);
+ $this->result = array(
+ 128 + $signal,
+ $this->stdout,
+ $this->stderr);
+ $this->closeProcess();
+ }
return $this->result;
}
Index: src/future/exec/__tests__/ExecFutureTestCase.php
===================================================================
--- src/future/exec/__tests__/ExecFutureTestCase.php
+++ src/future/exec/__tests__/ExecFutureTestCase.php
@@ -109,4 +109,16 @@
$this->assertEqual(true, ($end - $start) < 5);
}
+ public function testMultipleResolves() {
+ // It should be safe to call resolve(), resolvex(), resolveKill(), etc.,
+ // as many times as you want on the same process.
+
+ $future = new ExecFuture('echo quack');
+ $future->resolve();
+ $future->resolvex();
+ list($err) = $future->resolveKill();
+
+ $this->assertEqual(0, $err);
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 11:31 PM (4 h, 43 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6787370
Default Alt Text
D7688.diff (1 KB)

Event Timeline