Mail Archives: cygwin-developers/1998/04/08/23:29:43
Ian Lance Taylor wrote:
> but no __CYGWIN32__ case (mingw32?). I'm not sure that gcc will work
> properly if cpp will terminate due to some error (spawned ΣΣ1 will
inherit
> last_pipe_input and will never receive EOF!). The compilation will
just
> hangs...
Sorry, it was a wrong example.
>
> Can you describe the potential error more fully?
>
Look at pexecute.c (lines starting with 350):
/* If this isn't the last process, make a pipe for its output,
and record it as waiting to be the input to the next process. */
if (! (flags & PEXECUTE_LAST))
{
if (_pipe (pdes, 256, O_BINARY) < 0)
{
*errmsg_fmt = "pipe";
*errmsg_arg = NULL;
return -1;
}
output_desc = pdes[WRITE_PORT];
last_pipe_input = pdes[READ_PORT];
}
else
{
/* Last process. */
output_desc = STDOUT_FILE_NO;
last_pipe_input = STDIN_FILE_NO;
}
if (input_desc != STDIN_FILE_NO)
{
org_stdin = dup (STDIN_FILE_NO);
dup2 (input_desc, STDIN_FILE_NO);
close (input_desc);
}
if (output_desc != STDOUT_FILE_NO)
{
org_stdout = dup (STDOUT_FILE_NO);
dup2 (output_desc, STDOUT_FILE_NO);
close (output_desc);
}
pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
(_P_NOWAIT, program, fix_argv(argv));
Cpp (as a first task in a pipeline) will be started with stdout redirected
to a pipe and with inheritted pipe's read end (in
last_pipe_input=pdes[READ_PORT])! If cc1 will terminate _before_ cpp
termination (due to fatal syntax error), cpp will hang in a write to
stdout.
--
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia.
- Raw text -