plat/process.rs#
Source: lib/plat/process.rs
Native child processes for tools and application helpers; no assembly counterpart.
run_elevated / elevated: a program with administrator or root rights (a service install).
launch: a program on its own that outlives this one (the inspector's editor); find: the file
a program name stands for. Android has none of it (process_android.rs): every start answers
ENOTSUP (95), so apps build for every target without a cfg of their own.
struct Command<'a>Shell-free child invocation. Environment entries override inherited values.program: &'a str-- Executable path, or a program found in PATH.args: &'a [&'a str]-- Arguments excluding argv[0]; empty arguments are preserved.cwd: Option<&'a str>-- Child working directory, or None to inherit.env: &'a [(&'a str, Option<&'a str>)]-- Environment overrides; None removes a variable.
fn run_elevated(program: &str, args: &[&str]) -> Result<i32, String>Run a program with administrator / root rights and wait for it -> its exit code. Windows: the UAC prompt (ShellExecuteEx "runas", hidden window, no pipes); Linux: directly when this process is root, otherwise through pkexec (the desktop's password prompt). Err when the user refused or no way exists (the text says what to do).fn elevated() -> boolWhether this process runs with administrator (Windows) / root (Linux) rights.fn exec(program: &str, args: &[&str], env: &[(&str, Option<&str>)]) -> u32Replace this process by a program, keeping its PID, its terminal and its standard handles (Linux: execve; argv[0] = program, a name without '/' is looked up in PATH, the environment of this process with the overrides of env as in Command, SIGPIPE back to its default). Returns only on failure: the error number (refused by the manifest: EACCES). Windows has no such call: 50 (ERROR_NOT_SUPPORTED). The AppImage runtime (apps/appimagert) starts the AppRun of the image with it.fn launch(program: &str, args: &[&str]) -> Result<(), u32>Start a program on its own and do not wait for it: no pipes, none of this process's handles (Linux: its standard handles on /dev/null), and it is not ended with this process (Windows: no console window, outside this process's job when the job lets it go; Linux: adopted by init in a session of its own) -- an editor, a viewer. The manifest'sprocessrules apply as for Command::spawn (refused: 5 on Windows, 13 = EACCES on Linux); a program that cannot be started gives its error number (2: not found).fn find(name: &str) -> Option<String>The file a program name stands for, as Command::spawn and launch look it up (Windows: the program's folder, the system folders, then PATH, never the current folder; ".exe" added to a name without one; Linux: the first executable file in PATH). None for a path or no such program.
impl Command<'_>
fn spawn(&self) -> Result<Child, u32>Start a hidden process with pipes. Dropping its handle terminates its tree. Windows: a.bator.cmdfile runs through cmd.exe, which reads its command line by other rules; a program or argument with",%,!,^,&,|,<,>or a line break is refused for it (87), as for process::launch