mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Embed cocmd.com interpreter for system() / open()
This change lets you use system() in an easier and portable way. The problem with the call in the past has always been that bourne and cmd.com on Windows have less than nothing in common, so pretty much the only command system() could be used for across platforms was maybe echo. cmd.exe is also a security liability due to its escaping rules. Since cocmd.com implements 85% of what we need from bourne, in a really tiny way, it makes perfect sense to be embedded in these functionss. We get a huge performance boost too. Fixes #644
This commit is contained in:
parent
daca5499b9
commit
950a1b310b
9 changed files with 313 additions and 320 deletions
|
@ -29,6 +29,16 @@
|
|||
|
||||
/**
|
||||
* Spawns subprocess and returns pipe stream.
|
||||
*
|
||||
* This embeds the cocmd.com shell interpreter which supports a limited
|
||||
* subset of the bourne shell that's significantly faster:
|
||||
*
|
||||
* - pipelines
|
||||
* - single quotes
|
||||
* - double quotes
|
||||
* - input redirection, e.g. `<path`
|
||||
* - output redirection, e.g. `>path`, `>>append`, `2>err.txt, `2>&1`
|
||||
*
|
||||
* @see pclose()
|
||||
*/
|
||||
FILE *popen(const char *cmdline, const char *mode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue