Page MenuHomePhabricator

D11092.diff
No OneTemporary

D11092.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
@@ -636,6 +636,26 @@
}
}
+
+ // NOTE: Convert all the environmental variables we're going to pass
+ // into strings before we install PhutilErrorTrap. If something in here
+ // is really an object which is going to throw when we try to turn it
+ // into a string, we want the exception to escape here -- not after we
+ // start trapping errors.
+ $env = $this->env;
+ if ($env !== null) {
+ foreach ($env as $key => $value) {
+ $env[$key] = (string)$value;
+ }
+ }
+
+ // Same for the working directory.
+ if ($this->cwd === null) {
+ $cwd = null;
+ } else {
+ $cwd = (string)$this->cwd;
+ }
+
// NOTE: See note above about Phage.
if (class_exists('PhutilErrorTrap')) {
$trap = new PhutilErrorTrap();
@@ -647,8 +667,8 @@
$unmasked_command,
self::$descriptorSpec,
$pipes,
- $this->cwd,
- $this->env);
+ $cwd,
+ $env);
if ($trap) {
$err = $trap->getErrorsAsString();

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 30, 7:48 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6730833
Default Alt Text
D11092.diff (1 KB)

Event Timeline