Skip to content

Commit 3c9ba19

Browse files
committed
Only change to a drive letter first, if it is an absolute path on Windows.
1 parent b0c0bf3 commit 3c9ba19

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Command.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ public function setCommand($command)
149149
if ($this->getIsWindows()) {
150150
// Make sure to switch to correct drive like "E:" first if we have a full path in command
151151
$chdrive = (isset($command[1]) && $command[1]===':') ? $command[0].': && ' : '';
152-
$command = sprintf($chdrive.'cd %s && %s', escapeshellarg(dirname($command)), basename($command));
152+
153+
// 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));
156+
}
153157
}
154158
$this->_command = $command;
155159
return $this;

0 commit comments

Comments
 (0)