delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/03/01/04:51:03

Date: Mon, 1 Mar 1999 11:23:32 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
cc: djgpp-workers AT delorie DOT com
Subject: Re: inetutils
In-Reply-To: <199902281734.MAA26602@mccoy2.ECE.McGill.CA>
Message-ID: <Pine.SUN.3.91.990301112312.2578F-100000@is>
MIME-Version: 1.0
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019