Skip to content

Commit afb20fc

Browse files
etiennebarriebyroot
andcommitted
wip
Co-authored-by: Jean Boussier <[email protected]>
1 parent 4e6b0bd commit afb20fc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

process.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,21 +4622,25 @@ rb_posix_spawn(struct rb_execarg *eargp)
46224622
{
46234623
pid_t pid;
46244624
char *abspath = NULL;
4625+
char **argv = NULL;
46254626

4626-
if (!NIL_P(eargp->invoke.cmd.command_abspath)) {
4627+
if (RTEST(eargp->invoke.cmd.command_abspath)) {
46274628
abspath = RSTRING_PTR(eargp->invoke.cmd.command_abspath);
46284629
}
46294630
else {
46304631
errno = ENOENT;
46314632
return -1;
46324633
}
46334634

4634-
char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
4635+
argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
46354636

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

4639-
pid = posix_spawn(&pid, abspath, NULL, NULL, argv, envp);
4640+
int err = posix_spawn(&pid, abspath, NULL, NULL, argv, envp);
4641+
if (err) {
4642+
rb_sys_fail(abspath);
4643+
}
46404644

46414645
return (rb_pid_t)pid;
46424646
}

0 commit comments

Comments
 (0)