Commit Graph

6 Commits

Author SHA1 Message Date
James Ross-Gowan 42fa954849 subprocess-win: Always quote argv[0]
If the program name isn't quoted and the .exe it refers to isn't found,
CreateProcess will add the program arguments to the program name and
continue searching, so for "program arg1 arg2", CreateProcess would try
"program.exe", "program arg1.exe", then "program arg1 arg2.exe". This
behaviour is weird and not really desirable, so prevent it by always
quoting the program name.

When quoting argv[0], escape sequences shouldn't be used. msvcrt, .NET
and CommandLineToArgvW all treat argv[0] literally and end it on the
trailing quote, without processing escape sequences.
2015-01-16 22:39:55 +11:00
wm4 f61b8b312d win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
2015-01-07 21:42:44 +01:00
wm4 44701238c7 subprocess: allow disabling redirection of stdout/stderr
If the stdout or stderr write callback is NULL, then don't redirect this
stream. Preparation for the next commit.

Not sure what to do on Windows; it seems STARTUPINFO doesn't allow
redirection only one of them. So just let them write nothing. For our
intended use-case (next commit), this is probably sensible.
2015-01-01 20:04:38 +01:00
James Ross-Gowan c67048827e subprocess-win: remove a Vista-only flag
PIPE_REJECT_REMOTE_CLIENTS isn't supported on XP. It's not really
needed, so remove it. Also fix error checking for CreateNamedPipe.
2014-11-28 21:20:49 +11:00
wm4 1eeca36d5f subprocess: minor cosmetic cleanup
Don't recursively include the whole stream.h header; only include what's
minimally needed, and handle the rest with forward declarations.
2014-11-22 14:38:58 +01:00
James Ross-Gowan ef0d1cddb6 lua: subprocess: move to osdep/subprocess-{win,posix}.c
The subprocess code was already split into fairly general functions,
separate from the Lua code. It's getting pretty big though, especially
the Windows-specific parts, so move it into its own files.
2014-11-22 18:15:13 +11:00