1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibCore: Add posix_spawnp() wrapper that return ErrorOr<pid_t>

This commit is contained in:
Kenneth Myhra 2021-12-13 18:38:48 +01:00 committed by Brian Gianforcaro
parent 54f6829533
commit 123e49994d
2 changed files with 10 additions and 0 deletions

View file

@ -372,4 +372,12 @@ ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts)
#endif
}
ErrorOr<pid_t> posix_spawnp(StringView const path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[])
{
pid_t child_pid;
if ((errno = ::posix_spawnp(&child_pid, path.to_string().characters(), file_actions, attr, arguments, envp)))
return Error::from_syscall("posix_spawnp"sv, -errno);
return child_pid;
}
}