OSDN Git Service

behat: change subprocess PATH, instead of creating a function
authorscribu <mail@scribu.net>
Wed, 29 May 2013 16:41:29 +0000 (19:41 +0300)
committerscribu <mail@scribu.net>
Wed, 29 May 2013 17:05:11 +0000 (20:05 +0300)
see #475

features/bootstrap/Process.php

index 4dddf42..36ad7bc 100644 (file)
@@ -28,12 +28,9 @@ class Process {
                );
 
                // Ensure we're using the expected `wp` binary
-               $env = sprintf( 'function wp() { %s "$@"; }; %s',
-                       realpath( __DIR__ . "/../../bin/wp" ), $this->command );
-
-               $wrapper = sprintf( 'bash -c %s', escapeshellarg( $env ) );
-
-               $proc = proc_open( $wrapper, $descriptors, $pipes, $cwd );
+               $proc = proc_open( $this->command, $descriptors, $pipes, $cwd, array(
+                       'PATH' => realpath( __DIR__ . "/../../bin" ) . ':' . getenv( 'PATH' )
+               ) );
 
                $STDOUT = stream_get_contents( $pipes[1] );
                fclose( $pipes[1] );