classstuds::Proc
sys::Obj studs::Proc
Proc manages spawning an external OS process. This class differs from sys::Process by optimizing the API for interaction with the child process over stdio.
- cmd
const Str[] cmdCommand argument list used to launch process. The first item is the executable itself, then rest are the parameters.
- dir
const File? dir := nullWorking directory for child process.
- env
const Str:Str env := [Str:Str][:]Environment variables to pass to child process. This map is initialized with the current process environment.
- err
InStream err()Return InStream used to read process stderr.
- exitCode
Int? exitCode()Return the exit code for child process,
nullif process has not started, or throws Err if process has not yet terminated.- in
InStream in()Return InStream used to read process stdout.
- isRunning
Bool isRunning()Return
trueif child process is currently running orfalseif not started or terminated.- kill
This kill()Kill the child process. Use waitFor to block until the process has terminated.
- make
new make(|This f)It-block constructor.
- okOrThrow
This okOrThrow()Check the exit code the process returned. If the code was
0return this. If the code was non-zero throws an IOErr. If the process is still running, the same semantics apply as exitCode.- out
OutStream out()Return OutStream used to write to process stdin.
- redirectErr
const Bool redirectErr := trueIf
true, then stderr is redirected to stdout.- run
This run()- waitFor
This waitFor()Block the current thread until the child process has terminated. Use exitCode to retreive exit code.