diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-04-15 01:25:04 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-04-15 21:05:39 +0900 |
commit | 155f64e3c4ba23f0e85e8d69facceb21a487dccd (patch) | |
tree | f0c79b8bc3ddeedd98326dc45a5dd8cfc1917d08 /eval.c | |
parent | d72fd1e45b192ab507f8170ceec1328c2aae7bb1 (diff) |
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]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3035
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; } |