Instruct event loops to ignore SIGPIPE when constructed.

libuv does not always catch SIGPIPE.
This commit is contained in:
Eric Reed 2013-08-08 17:04:19 -07:00
parent f68514c128
commit 88f718341e
2 changed files with 10 additions and 0 deletions

View file

@ -172,6 +172,7 @@ fn request_sanity_check() {
}
}
// XXX Event loops ignore SIGPIPE by default.
pub unsafe fn loop_new() -> *c_void {
#[fixed_stack_segment]; #[inline(never)];

View file

@ -13,12 +13,21 @@
#include <malloc.h>
#endif
#ifndef __WIN32__
// for signal
#include <signal.h>
#endif
#include "uv.h"
#include "rust_globals.h"
extern "C" void*
rust_uv_loop_new() {
// XXX libuv doesn't always ignore SIGPIPE even though we don't need it.
#ifndef __WIN32__
signal(SIGPIPE, SIG_IGN);
#endif
return (void*)uv_loop_new();
}