mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
LibCore: Put destruction of posix_spawn_file_actions in ScopeGuard
This commit is contained in:
parent
1b486b8964
commit
ca4c402309
1 changed files with 2 additions and 1 deletions
|
@ -32,9 +32,10 @@ ErrorOr<NonnullOwnPtr<Command>> Command::create(StringView command, char const*
|
|||
posix_spawn_file_actions_adddup2(&file_actions, stdout_fds[1], STDOUT_FILENO);
|
||||
posix_spawn_file_actions_adddup2(&file_actions, stderr_fds[1], STDERR_FILENO);
|
||||
|
||||
ScopeGuard destroy_file_actions { [&file_actions] { posix_spawn_file_actions_destroy(&file_actions); } };
|
||||
|
||||
auto pid = TRY(Core::System::posix_spawnp(command, &file_actions, nullptr, const_cast<char**>(arguments), Core::Environment::raw_environ()));
|
||||
|
||||
posix_spawn_file_actions_destroy(&file_actions);
|
||||
ArmedScopeGuard runner_kill { [&pid] { kill(pid, SIGKILL); } };
|
||||
|
||||
TRY(Core::System::close(stdin_fds[0]));
|
||||
|
|
Loading…
Reference in a new issue