Skip to content

Commit

Permalink
Issue mikehaertl#16 Change to correct drive on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Jul 15, 2016
1 parent ff2cf46 commit d9a0e8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public function setCommand($command)
$command = escapeshellcmd($command);
}
if ($this->getIsWindows()) {
$command = sprintf('cd %s && %s', escapeshellarg(dirname($command)), basename($command));
// Make sure to switch to correct drive like "E:" first if we have a full path in command
$chdrive = (isset($command[1]) && $command[1]===':') ? $command[0].': && ' : '';
$command = sprintf($chdrive.'cd %s && %s', escapeshellarg(dirname($command)), basename($command));
}
$this->_command = $command;
return $this;
Expand Down

0 comments on commit d9a0e8e

Please sign in to comment.