On Mon, Aug 15, 2011 at 1:25 AM, Jan Kratochvil wrote: > On Sun, 14 Aug 2011 21:41:57 +0200, Eli Zaretskii wrote: >> > Abhijit Halder has suggested the suggested >> >     const char *argv[] = { "sh", "-c", "cat >/dev/null", NULL }; >> >     pex_run (pipe->pex, PEX_LAST, "/bin/sh", argv, NULL, NULL, &status); >> > works on UNIX but it will probably not work on MinGW as there is no "/bin/sh", >> > is it? >> >> The file name of the shell, the "-c" switch, and the null device >> should all be system-dependent.  For MinGW, they should be, >> respectively, "cmd.exe", "/c", and "nul". > > "cat >/dev/null" itself is user-entered command so that part is OK to be > non-cross-platform (therefore also "nul" is not valid). > > OK, "cmd.exe" with "/c" seems easy enough. > > >> > The current implementation: >> >     const char *argv[] = { "cat", ">/dev/null", NULL }; >> >     pex_run (pipe->pex, PEX_SEARCH | PEX_LAST, "cat", argv, NULL, NULL, &status); >> > produces that - therefore not working on UNIX: >> >     cat: >/dev/null: No such file or directory >> >> How hard is it to parse the redirection characters? > > Very, >, >>, &>, >&, &>>, x>&y, x>&y-, x<>y, many more. > > > Thanks, > Jan > Corrected the pattern matching code and added code to take care MinGW. Working on testcase and doc part.