diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-06-29 06:30:37 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-06-29 06:36:41 -0700 |
commit | 65fd38f6e1e94f55350cfe93e25c8264b972c3f6 (patch) | |
tree | 330fdb331b1e38a5490abc4e102ff023dd897adf /cmdwrap.c | |
parent | d41d8ed8ed5d73aa0abcd4f6e562d06df33dc3e9 (diff) | |
download | txr-65fd38f6e1e94f55350cfe93e25c8264b972c3f6.tar.gz txr-65fd38f6e1e94f55350cfe93e25c8264b972c3f6.tar.bz2 txr-65fd38f6e1e94f55350cfe93e25c8264b972c3f6.zip |
Fix command spawning on Cygwin-based standalone image.
In the standalone image, we need a /bin/sh interpreter
for the sh and open-command functions to work. The / path
resolves to the installation directory, thanks to some
sysrooting logic in the Cygwin DLL. Thus, we just need
a sh.exe program in the bin directory, side by side
with txr.exe. This sh.exe program can translate the
"sh -c command" invocation to "cmd.exe /c command".
* Makefile (sh.exe): New target, built from cmdwrap.c.
* cmdwrap.c: New file.
* inst.nsi: Install sh.exe.
Diffstat (limited to 'cmdwrap.c')
-rw-r--r-- | cmdwrap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cmdwrap.c b/cmdwrap.c new file mode 100644 index 00000000..51e44b07 --- /dev/null +++ b/cmdwrap.c @@ -0,0 +1,17 @@ +#include <process.h> +#include <stdlib.h> +#include <string.h> + +int main(int argc, char **argv) +{ + if (argc != 3) + return EXIT_FAILURE; + + if (strcmp(argv[1], "-c") != 0) + return EXIT_FAILURE; + + argv[0] = "c:/Windows/System32/cmd.exe"; + argv[1] = "/c"; + + return spawnvp(_P_WAIT, argv[0], (const char * const *) argv); +} |