mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +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
11 changed files with 77 additions and 28 deletions
|
@ -328,7 +328,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(),
|
||||
[&](auto&) {
|
||||
Core::Process::spawn("/bin/TerminalSettings");
|
||||
MUST(Core::Process::spawn("/bin/TerminalSettings"));
|
||||
});
|
||||
|
||||
TRY(terminal->context_menu().try_add_separator());
|
||||
|
@ -336,7 +336,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file_menu = TRY(window->try_add_menu("&File"));
|
||||
TRY(file_menu->try_add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
Core::Process::spawn("/bin/Terminal");
|
||||
MUST(Core::Process::spawn("/bin/Terminal"));
|
||||
})));
|
||||
|
||||
TRY(file_menu->try_add_action(open_settings_action));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue