From: sos AT prospect DOT com DOT ru (Sergey Okhapkin) Subject: RE: Question 8 Apr 1998 23:29:43 -0700 Message-ID: <01BD63A1.EC97AE90.cygnus.cygwin32.developers@SOMESHIT> To: "'Ian Lance Taylor'" Cc: "cygwin32-developers AT cygnus DOT com" 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.