summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-01-02 15:50:20 +0900
committerNobuyoshi Nakada <[email protected]>2025-01-02 15:50:20 +0900
commit8034e9c3d001ca3dff124ab42972684eac8af2ae (patch)
tree07d9f6de5837fe14973e73cf24deda966f913cd5 /io.c
parent6cf11ad76eae08ba9d2bdc70c093bc67aca93864 (diff)
[Bug #20995] Protect `IO.popen` block from exiting by exception
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12497
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 92fe5322da..a78936488f 100644
--- a/io.c
+++ b/io.c
@@ -8038,7 +8038,7 @@ popen_finish(VALUE port, VALUE klass)
if (NIL_P(port)) {
/* child */
if (rb_block_given_p()) {
- rb_yield(Qnil);
+ rb_protect(rb_yield, Qnil, NULL);
rb_io_flush(rb_ractor_stdout());
rb_io_flush(rb_ractor_stderr());
_exit(0);