class studs::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
waitForto 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 asexitCode. - out
-
OutStream out()Return OutStream used to write to process stdin.
- redirectErr
-
const Bool redirectErr := falseIf
true, then stderr is redirected to stdout. - run
-
This run()Spawn the child process. See
waitForto block until the process has terminated, andexitCodeto retreive process exit code. - sinkErr
-
This sinkErr()Sink the stderr output stream to Fantom's stdout. This method will spawn a background actor to pipe the process stderr stream to
Env.cur.out. Must be called afterrunand requiresredirectErrto befalse. Once this method has been invoked,erris no longer available. - waitFor
-
This waitFor()Block the current thread until the child process has terminated. Use
exitCodeto retreive exit code.