nuccio
nuccio

Reputation: 353

How to capture Process output in Fantom?

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)
   }
 }

Upvotes: 1

Views: 39

Answers (1)

Steve Eynon
Steve Eynon

Reputation: 5139

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)

Upvotes: 1

Related Questions