| 1 |
<?php |
| 2 |
|
| 3 |
namespace Shellbox\Command; |
| 4 |
|
| 5 |
class WindowsWrapper extends Wrapper { |
| 6 |
/** |
| 7 |
* Windows should be the outermost wrapper because of its special quoting |
| 8 |
*/ |
| 9 |
public const PRIORITY = 80; |
| 10 |
|
| 11 |
public function wrap( Command $command ) { |
| 12 |
// Windows Shell bypassed, but command run is "cmd.exe /C "{$cmd}" |
| 13 |
// This solves some shell parsing issues, see T207248. |
| 14 |
// This should be unnecessary in PHP 8.0+. |
| 15 |
$command->unsafeCommand( |
| 16 |
'cmd /s /c "' . $command->getCommandString() . '"' |
| 17 |
); |
| 18 |
$command->procOpenOptions( [ 'bypass_shell' => true ] ); |
| 19 |
} |
| 20 |
|
| 21 |
public function getPriority() { |
| 22 |
return self::PRIORITY; |
| 23 |
} |
| 24 |
} |