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[] cmd
Command argument list used to launch process. The first item is the executable itself, then rest are the parameters.
- dir
const File? dir := null
Working 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,
null
if 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
true
if child process is currently running orfalse
if 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
0
return 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 := false
If
true
, then stderr is redirected to stdout.- run
This run()
- 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 after run and requires redirectErr to befalse
. Once this method has been invoked, err is no longer available.- waitFor
This waitFor()
Block the current thread until the child process has terminated. Use exitCode to retreive exit code.