Skip to content

Instantly share code, notes, and snippets.

@fasterthanlime
Created March 24, 2015 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasterthanlime/3929fec7e90bfc2ae246 to your computer and use it in GitHub Desktop.
Save fasterthanlime/3929fec7e90bfc2ae246 to your computer and use it in GitHub Desktop.
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