comparison src/process.c @ 5588:2dbefd79b3d3

Prevent SIGPIPEs in deactivate_process(). * process.c (deactivate_process): Use Lstream_close_noflush on output pipe instead of Lstream_close. * lstream.c (Lstream_close_noflush): New. Factored out of Lstream_close. (Lstream_close): Use Lstream_close_noflush. * lstream.h (Lstream_close_noflush): Declare it.
author Stephen J. Turnbull <stephen@xemacs.org>
date Sat, 29 Oct 2011 01:10:32 +0900
parents 56144c8593a8
children 3192994c49ca
comparison
equal deleted inserted replaced
5587:3fde0e346ad7 5588:2dbefd79b3d3
2148 /* #### The comment does not look correct. event_stream_unselect_process 2148 /* #### The comment does not look correct. event_stream_unselect_process
2149 is guarded by process->*_selected, so this is not a problem. - kkm*/ 2149 is guarded by process->*_selected, so this is not a problem. - kkm*/
2150 /* Must call this before setting the streams to nil */ 2150 /* Must call this before setting the streams to nil */
2151 event_stream_unselect_process (p, 1, 1); 2151 event_stream_unselect_process (p, 1, 1);
2152 2152
2153 /* We can get here in case of a crash in the external process, and then
2154 the Lstream_close on output will cause a SIGPIPE, which we're not ready
2155 for here. It looks to me like all cases where this function is called
2156 we know the process has exited (but I'm not 100% sure for the call in
2157 execute_internal_event (event-stream.c)), so it should be OK to use
2158 Lstream_close_noflush.
2159
2160 #### The layering here needs a rethink. We should just be able
2161 to call Lstream_close, and let the Lstream's implementation decide
2162 if it can flush safely or not. The immediate problem is that the
2163 Lstream needs to know the process's status, but I don't think it has
2164 a handle to the process. */
2153 if (!NILP (DATA_OUTSTREAM (p))) 2165 if (!NILP (DATA_OUTSTREAM (p)))
2154 Lstream_close (XLSTREAM (DATA_OUTSTREAM (p))); 2166 Lstream_close_noflush (XLSTREAM (DATA_OUTSTREAM (p)));
2155 if (!NILP (DATA_INSTREAM (p))) 2167 if (!NILP (DATA_INSTREAM (p)))
2156 Lstream_close (XLSTREAM (DATA_INSTREAM (p))); 2168 Lstream_close (XLSTREAM (DATA_INSTREAM (p)));
2157 if (!NILP (DATA_ERRSTREAM (p))) 2169 if (!NILP (DATA_ERRSTREAM (p)))
2158 Lstream_close (XLSTREAM (DATA_ERRSTREAM (p))); 2170 Lstream_close (XLSTREAM (DATA_ERRSTREAM (p)));
2159 2171