mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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:
parent
d72fd1e45b
commit
155f64e3c4
Notes:
git
2020-04-15 22:08:49 +09:00
4 changed files with 23 additions and 9 deletions
6
eval.c
6
eval.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue