exec
import std::process::exec; · source
Free Functions
function shell(command: string) -> i32;
function shell(command: string) -> i32;Run command through the platform shell (/bin/sh -c on POSIX, the C runtime's system/cmd /c on Windows), inheriting stdio, and return the child's exit code (0 on success), or -1 if the shell could not be spawned or the child was killed by a signal. The cross-platform replacement for the raw system(3) intrinsic when a command genuinely needs shell semantics (pipes, redirects, glob expansion).
Also reachable as Command::shell. This is the cross-platform replacement for the raw system(3) intrinsic when a command genuinely needs shell semantics: pipes, redirects, glob expansion. For a plain program invocation, build the argv with Command and call status instead.
import a::b;
import a::b::{ X, Y };
import a::b as c;
import a::b::*;Brings a module, or selected items from it, into scope. One path per declaration: use the brace form for several items, as to alias, and * for everything public (prefer the brace form; wildcards invite name collisions).
function name<T>(param: Type) -> Ret { ... }Declares a function. Parameters are written name: Type and are never inferred; the return type follows -> and defaults to void. Declaration order does not matter: every signature is collected before any body is checked, so functions may call each other freely and recurse.
function shell(command: string) -> i32Run command through the platform shell (/bin/sh -c on POSIX, the C runtime's system/cmd /c on Windows), inheriting stdio, and return the child's exit code (0 on success), or -1 if the shell could not be spawned or the child was killed by a signal.
(parameter) command: stringprimitive stringNUL-terminated raw string (u8*), matching the C ABI. Length-typed text is Str / String.
extern "C" function system(command: u8*) -> i32type struct Command {
program: String;
args: Array<String>;
envs: Array<EnvEntry>;
clear_env_flag: boolean;
cwd: Option<String>;
stdin_cfg: Stdio;
stdout_cfg: Stdio;
stderr_cfg: Stdio;
}Command: builder for spawning a subprocess.
std::process::commandstatic Command::shell(command: string) -> i32Run command through the platform shell (/bin/sh -c on POSIX, cmd /c on Windows), inheriting stdio, and return the child's exit code (0 on success), or -1 if the shell could not be spawned or the child was killed by a signal.