summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-05-21 16:47:14 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-05-21 16:47:14 +0900
commit08675889802be222ae01db7d0d54c7e1b45bffc5 (patch)
tree483658011d229f8d2fbbdf2b7a724e05e4b9c87d /ruby.c
parent4f4bc13eb92539b9e988aa27be1c1d01bd2e0fe6 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7833
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c4
1 files changed, 3 insertions, 1 deletions
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);