/* * Copyright (c) 2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include ErrorOr serenity_main(Main::Arguments arguments) { unsigned jail_index = 0; Vector command; Core::ArgsParser args_parser; bool preserve_env = false; args_parser.set_stop_on_first_non_option(true); args_parser.add_option(preserve_env, "Preserve user environment when running command", "preserve-env", 'E'); args_parser.add_positional_argument(jail_index, "Jail Index", "jail index"); args_parser.add_positional_argument(command, "Command to execute", "command"); args_parser.parse(arguments); TRY(Core::System::pledge("stdio rpath exec id jail tty")); TRY(Core::System::join_jail(jail_index)); TRY(Core::System::exec_command(command, preserve_env)); return 0; }