File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,19 @@ public function setCommand($command)
148148 }
149149 if ($ this ->getIsWindows ()) {
150150 // Make sure to switch to correct drive like "E:" first if we have a full path in command
151- $ chdrive = (isset ($ command [1 ]) && $ command [1 ]===': ' ) ? $ command [0 ].': && ' : '' ;
152- $ command = sprintf ($ chdrive .'cd %s && %s ' , escapeshellarg (dirname ($ command )), basename ($ command ));
151+ if (isset ($ command [1 ]) && $ command [1 ]===': ' ) {
152+ $ position = 1 ;
153+ // Could be a quoted absolute path because of spaces. i.e. "C:\Program Files (x86)\file.exe"
154+ } elseif (isset ($ command [2 ]) && $ command [2 ]===': ' ) {
155+ $ position = 2 ;
156+ } else {
157+ $ position = false ;
158+ }
159+
160+ // Absolute path. If it's a relative path, let it slide.
161+ if ($ position ) {
162+ $ command = sprintf ($ command [$ position - 1 ].': && cd %s && %s ' , escapeshellarg (dirname ($ command )), basename ($ command ));
163+ }
153164 }
154165 $ this ->_command = $ command ;
155166 return $ this ;
You can’t perform that action at this time.
0 commit comments