Skip to content
CryoCryo home
Stdlibprocess

exec

import std::process::exec; · source

Free Functions

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.