Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14091353
D7688.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
D7688.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D7688: Make it safe to call ExecFuture->resolveKill() after process resolution
Attached
Detach File
Event Timeline
Log In to Comment