Skip to content

Commit

Permalink
Instruct event loops to ignore SIGPIPE when constructed.
Browse files Browse the repository at this point in the history
libuv does not always catch SIGPIPE.
  • Loading branch information
anasazi committed Aug 19, 2013
1 parent f68514c commit 88f7183
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libstd/rt/uv/uvll.rs
Expand Up @@ -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)];

Expand Down
9 changes: 9 additions & 0 deletions src/rt/rust_uv.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 88f7183

Please sign in to comment.