ladybird/Userland/Libraries/LibCore/Process.h
MacDue 3fc0350caf LibCore: Return ErrorOr<pid_t> and support arguments in Process::spawn
This makes the wrapper more like the rest in LibCore, and also
removes the annoying limitation of not supporting arguments.

There are three overloads one for String, char const *, and StringView
argument lists. As long as there are <= 10 arguments the argv list
will be allocated inline, otherwise on the heap.
2022-05-25 23:14:22 +01:00

22 lines
526 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <AK/Span.h>
namespace Core {
class Process {
public:
static ErrorOr<pid_t> spawn(StringView path, Span<String const> arguments);
static ErrorOr<pid_t> spawn(StringView path, Span<StringView const> arguments);
static ErrorOr<pid_t> spawn(StringView path, Span<char const* const> arguments = {});
};
}