mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
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.
This commit is contained in:
parent
0295d79339
commit
3fc0350caf
Notes:
sideshowbarker
2024-07-17 10:39:57 +09:00
Author: https://github.com/MacDue
Commit: 3fc0350caf
Pull-request: https://github.com/SerenityOS/serenity/pull/13999
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/linusg
11 changed files with 77 additions and 28 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -7,12 +8,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Span.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Process {
|
||||
public:
|
||||
static pid_t spawn(StringView path);
|
||||
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 = {});
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue