Raise EPIPE at broken pipe for the backward compatibility

Instead of SignalException for SIGPIPE, raise `Errno::EPIPE` with
instance variable `signo` and re-send that signal at exit.
[Feature #14413]
This commit is contained in:
Nobuyoshi Nakada 2020-04-15 01:25:04 +09:00
parent d72fd1e45b
commit 155f64e3c4
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
Notes: git 2020-04-15 22:08:49 +09:00
4 changed files with 23 additions and 9 deletions

6
eval.c
View file

@ -243,6 +243,7 @@ rb_ec_cleanup(rb_execution_context_t *ec, volatile int ex)
state = 0;
for (nerr = 0; nerr < numberof(errs); ++nerr) {
VALUE err = ATOMIC_VALUE_EXCHANGE(errs[nerr], Qnil);
VALUE sig;
if (!RTEST(err)) continue;
@ -258,6 +259,11 @@ rb_ec_cleanup(rb_execution_context_t *ec, volatile int ex)
state = NUM2INT(sig);
break;
}
else if (rb_obj_is_kind_of(err, rb_eSystemCallError) &&
FIXNUM_P(sig = rb_attr_get(err, id_signo))) {
state = NUM2INT(sig);
break;
}
else if (sysex == EXIT_SUCCESS) {
sysex = EXIT_FAILURE;
}