Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. [MinGW question]

Eli Zaretskii
2011-08-14T19:42:20Z

> Date: Sun, 14 Aug 2011 19:01:36 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: abhijit.k.halder@gmail.com, sergiodj@redhat.com, tromey@redhat.com,
> pedro@codesourcery.com, gdb-patches@sourceware.org
>
> > What exactly might not work?
>
> 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".

> 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?