File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1596,7 +1596,12 @@ enum uv_process_flags {
15961596 * option is only meaningful on Windows systems. On unix it is silently
15971597 * ignored.
15981598 */
1599- UV_PROCESS_WINDOWS_HIDE = (1 << 4 )
1599+ UV_PROCESS_WINDOWS_HIDE = (1 << 4 ),
1600+ /*
1601+ * Reset SIGPIPE to the default handler. Useful for parent processes that ignore
1602+ * SIGPIPE, but don't want to make the same assumption for child processes
1603+ */
1604+ UV_PROCESS_RESET_SIGPIPE = (1 << 5 )
16001605};
16011606
16021607/*
Original file line number Diff line number Diff line change @@ -282,6 +282,12 @@ static void uv__process_child_init(const uv_process_options_t* options,
282282 _exit (127 );
283283 }
284284
285+ if ((options -> flags & UV_PROCESS_RESET_SIGPIPE ) && signal (SIGPIPE ,SIG_DFL ) == SIG_ERR )
286+ {
287+ uv__write_int (error_fd , - errno );
288+ _exit (127 );
289+ }
290+
285291 if (options -> env != NULL ) {
286292 environ = options -> env ;
287293 }
@@ -310,7 +316,8 @@ int uv_spawn(uv_loop_t* loop,
310316 UV_PROCESS_SETGID |
311317 UV_PROCESS_SETUID |
312318 UV_PROCESS_WINDOWS_HIDE |
313- UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS )));
319+ UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS |
320+ UV_PROCESS_RESET_SIGPIPE )));
314321
315322 uv__handle_init (loop , (uv_handle_t * )process , UV_PROCESS );
316323 QUEUE_INIT (& process -> queue );
You can’t perform that action at this time.
0 commit comments