File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -147,12 +147,19 @@ public function setCommand($command)
147
147
$ command = escapeshellcmd ($ command );
148
148
}
149
149
if ($ this ->getIsWindows ()) {
150
+ $ position = null ;
151
+
150
152
// 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 ].': && ' : '' ;
153
+ if (isset ($ command [1 ]) && $ command [1 ]===': ' ) {
154
+ $ position = 1 ;
155
+ // Could be a quoted absolute path because of spaces. i.e. "C:\Program Files (x86)\file.exe"
156
+ } elseif (isset ($ command [2 ]) && $ command [2 ]===': ' ) {
157
+ $ position = 2 ;
158
+ }
152
159
153
160
// Absolute path. If it's a relative path, let it slide.
154
- if ($ chdrive ) {
155
- $ command = sprintf ($ chdrive .'cd %s && %s ' , escapeshellarg (dirname ($ command )), basename ($ command ));
161
+ if ($ position ) {
162
+ $ command = sprintf ($ command [ $ position - 1 ] .'cd %s && %s ' , escapeshellarg (dirname ($ command )), basename ($ command ));
156
163
}
157
164
}
158
165
$ this ->_command = $ command ;
You can’t perform that action at this time.
0 commit comments