diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php @@ -76,18 +76,7 @@ $cmd = $lease->getInterface('command'); - if ($v_platform !== 'windows') { - $cmd->execx('mkdir %s', $full_path); - } else { - // Windows is terrible. The mkdir command doesn't even support putting - // the path in quotes. IN QUOTES. ARGUHRGHUGHHGG!! Do some terribly - // inaccurate sanity checking since we can't safely escape the path. - if (preg_match('/^[A-Z]\\:\\\\[a-zA-Z0-9\\\\\\ ]/', $full_path) === 0) { - throw new Exception( - 'Unsafe path detected for Windows platform: "'.$full_path.'".'); - } - $cmd->execx('mkdir %C', $full_path); - } + list($stdout, $stderr) = $cmd->execx('mkdir %s', $full_path); $lease->setAttribute('path', $full_path); } diff --git a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php --- a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php +++ b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php @@ -41,17 +41,49 @@ $command = id(new PhutilCommandString($argv)) ->setEscapingMode(PhutilCommandString::MODE_POWERSHELL); + $encapsulate_command = array('%s', (string)$command); + $double_command = id(new PhutilCommandString($encapsulate_command)) + ->setEscapingMode(PhutilCommandString::MODE_POWERSHELL); + $change_directory = ''; if ($this->getWorkingDirectory() !== null) { $change_directory .= 'cd '.$this->getWorkingDirectory(); } $script = <<