pub fn spawn_process(
bin_name: &str,
args: &[&str],
show_console: bool,
) -> Result<Child>Expand description
Spawns a REKTAL binary (e.g. "kernel" or "gui") as an independent, detached process.
Resolves the sibling binary located alongside the current launcher executable and launches it with the provided CLI arguments.
§Arguments
bin_name- The base name of the target binary to spawn (e.g."kernel","gui"). On Windows,.exeis automatically checked and appended if applicable.args- A slice of command-line argument strings to pass to the spawned process.show_console- Whentrue, opens the process inside a visible, native OS terminal window with a pause prompt on termination. Whenfalse, launches the process silently in the background with suppressed standard streams.
§Returns
Returns a std::io::Result<std::process::Child> representing the spawned child process handle.
§Errors
Returns an std::io::Error if:
- The current executable path cannot be determined.
- The target binary cannot be found or executed.
- The platform terminal emulator cannot be spawned.
§Platform Behavior
- Windows: Utilizes
CREATE_NEW_CONSOLEandCREATE_NEW_PROCESS_GROUPcreation flags. - Linux: Prioritizes
$TERMINAL,xdg-terminal-exec,x-terminal-emulator, and fallback terminal emulators (gnome-terminal,konsole,xterm). Setsprocess_group(0)to decouple. - macOS: Dispatches script execution to
Terminal.appviaosascriptor runs headless withprocess_group(0).