This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]