Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F87948
D7688.diff
All Users
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
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
@@ -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;
}
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
@@ -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/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/om/jk/zpcciighgbeh2ofv
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