@@ -13,7 +13,7 @@ public function __construct(
13
13
) {}
14
14
}
15
15
16
- function runCommand (array $ args , ?string $ cwd = null ): ProcessResult {
16
+ function runCommand (array $ args , ?string $ cwd = null , ? array $ envVars = null ): ProcessResult {
17
17
$ cmd = implode ('' , array_map (function (string |UnescapedArg $ v ): string {
18
18
return $ v instanceof UnescapedArg
19
19
? $ v ->arg
@@ -22,7 +22,7 @@ function runCommand(array $args, ?string $cwd = null): ProcessResult {
22
22
$ pipes = null ;
23
23
$ descriptorSpec = [0 => ['pipe ' , 'r ' ], 1 => ['pipe ' , 'w ' ], 2 => ['pipe ' , 'w ' ]];
24
24
fwrite (STDOUT , "> $ cmd \n" );
25
- $ processHandle = proc_open ($ cmd , $ descriptorSpec , $ pipes , $ cwd ?? getcwd (), null );
25
+ $ processHandle = proc_open ($ cmd , $ descriptorSpec , $ pipes , $ cwd ?? getcwd (), $ envVars );
26
26
27
27
$ stdin = $ pipes [0 ];
28
28
$ stdout = $ pipes [1 ];
@@ -60,7 +60,7 @@ function runCommand(array $args, ?string $cwd = null): ProcessResult {
60
60
61
61
fclose ($ stdout );
62
62
fclose ($ stderr );
63
-
63
+
64
64
$ result = new ProcessResult ($ stdoutStr , $ stderrStr );
65
65
66
66
$ statusCode = proc_close ($ processHandle );
0 commit comments