Skip to content

Commit 88f7183

Browse files
committed
Instruct event loops to ignore SIGPIPE when constructed.
libuv does not always catch SIGPIPE.
1 parent f68514c commit 88f7183

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/libstd/rt/uv/uvll.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ fn request_sanity_check() {
172172
}
173173
}
174174

175+
// XXX Event loops ignore SIGPIPE by default.
175176
pub unsafe fn loop_new() -> *c_void {
176177
#[fixed_stack_segment]; #[inline(never)];
177178

src/rt/rust_uv.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,21 @@
1313
#include <malloc.h>
1414
#endif
1515

16+
#ifndef __WIN32__
17+
// for signal
18+
#include <signal.h>
19+
#endif
20+
1621
#include "uv.h"
1722

1823
#include "rust_globals.h"
1924

2025
extern "C" void*
2126
rust_uv_loop_new() {
27+
// XXX libuv doesn't always ignore SIGPIPE even though we don't need it.
28+
#ifndef __WIN32__
29+
signal(SIGPIPE, SIG_IGN);
30+
#endif
2231
return (void*)uv_loop_new();
2332
}
2433

0 commit comments

Comments
 (0)