mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +00:00
LibCore/Process: Add DupFd file action
This commit provides a new file action allowing callers to provide a `write_fd` that Process will "redirect" the child's stdin/stdout to.
This commit is contained in:
@@ -121,6 +121,10 @@ ErrorOr<Process> Process::spawn(ProcessSpawnOptions const& options)
|
||||
[&](FileAction::CloseFile const& action) -> ErrorOr<void> {
|
||||
CHECK(posix_spawn_file_actions_addclose(&spawn_actions, action.fd));
|
||||
return {};
|
||||
},
|
||||
[&](FileAction::DupFd const& action) -> ErrorOr<void> {
|
||||
CHECK(posix_spawn_file_actions_adddup2(&spawn_actions, action.write_fd, action.fd));
|
||||
return {};
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user