1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +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:
MacDue 2022-05-10 00:24:15 +01:00 committed by Linus Groh
parent 0295d79339
commit 3fc0350caf
11 changed files with 77 additions and 28 deletions

View file

@ -104,7 +104,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto launch_origin_rect = icon_view->to_widget_rect(icon_view->content_rect(index)).translated(icon_view->screen_relative_rect().location());
setenv("__libgui_launch_origin_rect", String::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1);
Core::Process::spawn(executable);
MUST(Core::Process::spawn(executable));
};
auto statusbar = TRY(main_widget->try_add<GUI::Statusbar>());