Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use posix spawn #551

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
env
Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
  • Loading branch information
etiennebarrie and byroot committed Jan 24, 2024
commit ea92bfd86e1890a6c3843fcfafcb653f80843c4c
6 changes: 5 additions & 1 deletion process.c
Original file line number Diff line number Diff line change
@@ -4634,7 +4634,11 @@ rb_posix_spawn(struct rb_execarg *eargp)
}

char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
pid = posix_spawn(&pid, abspath, NULL, NULL, argv, NULL);

VALUE envp_str = eargp->envp_str;
char **envp = RTEST(envp_str) ? RB_IMEMO_TMPBUF_PTR(envp_str) : NULL;

pid = posix_spawn(&pid, abspath, NULL, NULL, argv, envp);

return (rb_pid_t)pid;
}