HackStudio: Use Core::System::exec()

This commit is contained in:
Sam Atkins 2022-04-02 13:49:58 +01:00 committed by Andreas Kling
parent 88800e8f32
commit eb857e45dc
Notes: sideshowbarker 2024-07-17 12:05:40 +09:00

View file

@ -60,18 +60,9 @@ ErrorOr<void> TerminalWrapper::run_command(String const& command, Optional<Strin
TRY(setup_slave_pseudoterminal(ptm_fd));
auto parts = command.split(' ');
VERIFY(!parts.is_empty());
char const** args = (char const**)calloc(parts.size() + 1, sizeof(char const*));
for (size_t i = 0; i < parts.size(); i++) {
args[i] = parts[i].characters();
}
auto rc = execvp(args[0], const_cast<char**>(args));
if (rc < 0) {
perror("execve");
exit(1);
}
auto args = command.split_view(' ');
VERIFY(!args.is_empty());
TRY(Core::System::exec(args[0], args, Core::System::SearchInPath::Yes));
VERIFY_NOT_REACHED();
}