Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/PhutilExecPassthru.php
| Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | public function execute() { | ||||
| $options = array(); | $options = array(); | ||||
| if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
| // Without 'bypass_shell', things like launching vim don't work properly, | // Without 'bypass_shell', things like launching vim don't work properly, | ||||
| // and we can't execute commands with spaces in them, and all commands | // and we can't execute commands with spaces in them, and all commands | ||||
| // invoked from git bash fail horridly, and everything is a mess in | // invoked from git bash fail horridly, and everything is a mess in | ||||
| // general. | // general. | ||||
| $options['bypass_shell'] = true; | $options['bypass_shell'] = true; | ||||
| // Since we are not using CMD anymore, set the escaping mode accordingly | |||||
| if ($command instanceof PhutilCommandString) { | |||||
| $command->setEscapingMode(PhutilCommandString::MODE_WIN_PASSTHRU); | |||||
BYK: We need this mode for all `'bypass_shell' => true`. The current implementation may not be the… | |||||
| } | |||||
| } | } | ||||
| $trap = new PhutilErrorTrap(); | $trap = new PhutilErrorTrap(); | ||||
Not Done Inline ActionsThis change of order was needed because of the mode change above. Could have kept the ordering and added another phutil_is_windows but that seemed wasteful. BYK: This change of order was needed because of the mode change above. Could have kept the ordering… | |||||
| $proc = @proc_open( | $proc = @proc_open( | ||||
| $unmasked_command, | $unmasked_command, | ||||
| $spec, | $spec, | ||||
| $pipes, | $pipes, | ||||
| $cwd, | $cwd, | ||||
| $env, | $env, | ||||
| $options); | $options); | ||||
| $errors = $trap->getErrorsAsString(); | $errors = $trap->getErrorsAsString(); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||
We need this mode for all 'bypass_shell' => true. The current implementation may not be the greatest way to achieve this.