diff options
author | MacDue <macdue@dueutil.tech> | 2023-03-13 20:33:22 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-24 22:06:38 +0000 |
commit | 0af3e37f5d1c2b105e6432c6bf1d2b3ef291f76a (patch) | |
tree | 97e59d14c3725d758b367a28979c9be84f7a368e /Userland/Services | |
parent | ceffca9a75899eb8bcfdc089e7999e2db96e3bce (diff) | |
download | serenity-0af3e37f5d1c2b105e6432c6bf1d2b3ef291f76a.zip |
KeyboardPreferenceLoader: Use Core::Process::spawn() to set keymap
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/KeyboardPreferenceLoader/main.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Services/KeyboardPreferenceLoader/main.cpp b/Userland/Services/KeyboardPreferenceLoader/main.cpp index 6fac3009fc..5eb3eb46bb 100644 --- a/Userland/Services/KeyboardPreferenceLoader/main.cpp +++ b/Userland/Services/KeyboardPreferenceLoader/main.cpp @@ -6,6 +6,7 @@ #include <LibCore/ConfigFile.h> #include <LibCore/DeprecatedFile.h> +#include <LibCore/Process.h> #include <LibCore/System.h> #include <LibMain/Main.h> #include <errno.h> @@ -30,12 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments) if (keymaps_vector.size() == 0) exit(1); - pid_t child_pid; - char const* argv[] = { "/bin/keymap", "-m", keymaps_vector.first().characters(), nullptr }; - if ((errno = posix_spawn(&child_pid, "/bin/keymap", nullptr, nullptr, const_cast<char**>(argv), environ))) { - perror("posix_spawn"); - exit(1); - } + TRY(Core::Process::spawn("/bin/keymap"sv, Array { "-m", keymaps_vector.first().characters() }, {}, Core::Process::KeepAsChild::Yes)); bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true); auto keyboard_device = TRY(Core::DeprecatedFile::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly)); |