Date: Mon, 1 Mar 1999 11:23:32 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alain Magloire cc: djgpp-workers AT delorie DOT com Subject: Re: inetutils In-Reply-To: <199902281734.MAA26602@mccoy2.ECE.McGill.CA> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com On Sun, 28 Feb 1999, Alain Magloire wrote: > dup2(fdmap[0], FILENO_STDIN); > dup2(fdmap[1], FILENO_STDOUT); > dup2(fdmap[2], FILENO_STDERR); > pid = spawn(P_NOWAIT, "start", "/m", path, NULL); Well, that's just it: the program run by "start /m" doesn't inherit the standard handles from the parent program. "start" creates a new virtual machine and runs the program inside it, but it doesn't pass it the file handle redirection and the environment of the program which called "start". So you will need to do something like this: system ("start.exe /m redir -i input -o output -e error foo.exe"); ("redir" is a standard program that comes with DJGPP.) This still has some problems, like passing the environment variables (we could change "redir" to read them from a file), and the redirection will not work in certain cases, like when the parent and the child try to write to the same file, because Windows generally prevents two programs from writing to the same file.