From 08675889802be222ae01db7d0d54c7e1b45bffc5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 21 May 2023 16:47:14 +0900 Subject: [PATCH] Use `rb_fork_ruby` for `--help` pager Instead of `rb_fork`, to update `current_fork_gen` which has been introduced at 3563e1383fe4ce13168cd3b9f4d5222d69d00061. Otherwise, the forked process attempts to stop the timer thread, but raises an exception because the thread is not alive in the child and dies because already no tag is present at that time. --- ruby.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruby.c b/ruby.c index 8f4659db01..6e0e72bf55 100644 --- a/ruby.c +++ b/ruby.c @@ -1824,6 +1824,8 @@ env_var_truthy(const char *name) } #endif +rb_pid_t rb_fork_ruby(int *status); + static VALUE process_options(int argc, char **argv, ruby_cmdline_options_t *opt) { @@ -1860,7 +1862,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) #ifdef HAVE_WORKING_FORK int fds[2]; if (rb_pipe(fds) == 0) { - rb_pid_t pid = rb_fork(); + rb_pid_t pid = rb_fork_ruby(NULL); if (pid > 0) { /* exec PAGER with reading from child */ dup2(fds[0], 0);