crystal
crystal copied to clipboard
Disable implicit execution of batch files
This patch disables the implicit execution of batch files (i.e. path name extension .bat
or .cmd
, case-insensitive) in Process.run
on Windows with shell: false
(default). There are no effects on other operating systems.
The disabled behaviour is an irrational and potentially dangerous feature of CreateProcessW
which is not intended for Process.run
.
If you want to run a batch file on Windows, you need to launch it through a shell, either implicitly with shell: true
or explicitly by running cmd.exe
with the batch file as argument.
The semantics are different on POSIX platforms where you can directly execute a shell script if it has a shebang. The mechanism on Windows works differently, as CreateProcessW
implicitly injects cmd.exe /c
which changes the semantics of run arguments.
A similar approach has been taken by node.js: https://github.com/nodejs/node/commit/64b67779f72ea9e4a0f444284576df9e591d79a0
Resolves #14536