LibCore/Process: Make all spawn overloads return ErrorOr<Process>

This commit is contained in:
stasoid 2024-11-17 20:11:13 +05:00 committed by Andrew Kaster
commit 4a731b3858
Notes: github-actions[bot] 2024-11-19 22:28:35 +00:00
6 changed files with 22 additions and 27 deletions

View file

@ -74,9 +74,8 @@ public:
static ErrorOr<Process> spawn(ProcessSpawnOptions const& options);
static Process current();
// FIXME: Make the following 2 functions return Process instance or delete them.
static ErrorOr<pid_t> spawn(StringView path, ReadonlySpan<ByteString> arguments, ByteString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
static ErrorOr<pid_t> spawn(StringView path, ReadonlySpan<StringView> arguments, ByteString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
static ErrorOr<Process> spawn(StringView path, ReadonlySpan<ByteString> arguments, ByteString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
static ErrorOr<Process> spawn(StringView path, ReadonlySpan<StringView> arguments, ByteString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
static ErrorOr<String> get_name();
enum class SetThreadName {
@ -96,7 +95,7 @@ public:
ErrorOr<bool> wait_for_termination();
private:
Process(pid_t pid)
Process(pid_t pid = -1)
: m_pid(pid)
, m_should_disown(true)
{