How to capture Process output in Fantom?

38 Views Asked by At

How do I capture the stream that is being created for the Process? See the limited Fantom documentation for Process: http://fantom.org/doc/sys/Process

class Ipconfig {

   Void main() {
     proc := Process()
     proc.command = Str["ipconfig"]
     proc.in = Env.cur().in
     proc.run
     proc.join
     test := proc.in.readAllLines
     echo(test)
   }
 }
1

There are 1 best solutions below

0
Steve Eynon On BEST ANSWER

It looks like you're mixing up your inputs and outputs. You want to set and capture the output for the process, like this:

buf := Buf()

Process() {
    command = Str["ipconfig"]
    out = buf.out 
}.run.join

outStr := buf.flip.readAllStr
echo(outStr)