Page MenuHomePhabricator

D7396.id16688.diff

D7396.id16688.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
@@ -36,6 +36,7 @@
protected $stdoutPos = 0;
protected $stderrPos = 0;
protected $command = null;
+ protected $env = null;
protected $cwd;
protected $stdoutSizeLimit = PHP_INT_MAX;
@@ -168,6 +169,23 @@
}
+ /**
+ * Set the environment variables to use when executing the command.
+ *
+ * @param array Environment variables to use when executing the command.
+ * @return this
+ * @task config
+ */
+ public function setEnv($env, $wipe_process_env = false) {
+ if ($wipe_process_env) {
+ $this->env = $env;
+ } else {
+ $this->env = array_merge($env, $_ENV);
+ }
+ return $this;
+ }
+
+
/* -( Interacting With Commands )------------------------------------------ */
@@ -522,7 +540,8 @@
$unmasked_command,
self::$descriptorSpec,
$pipes,
- $this->cwd);
+ $this->cwd,
+ $this->env);
if ($trap) {
$err = $trap->getErrorsAsString();

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/zl/al/a5vvhkyfozqezrmy
Default Alt Text
D7396.id16688.diff (1 KB)

Event Timeline