Created
March 24, 2015 16:55
-
-
Save fasterthanlime/3929fec7e90bfc2ae246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os/[Process, Pipe, Time] | |
main: func { | |
pipe := Pipe new() | |
p := Process new(["sh", "-c", "while true; do echo Hi; sleep .1; done"]) | |
p setStdout(pipe) | |
p executeNoWait() | |
reader := pipe reader() | |
while (Time runTime() < 1000) { | |
line := reader readLine() | |
"> #{line}" println() | |
} | |
p kill() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment