Skip to content

Instantly share code, notes, and snippets.

@chrisortman
Created May 26, 2017 15:45
Show Gist options
  • Save chrisortman/b620399670d033cb2fcf5f0ebf9bc2ee to your computer and use it in GitHub Desktop.
Save chrisortman/b620399670d033cb2fcf5f0ebf9bc2ee to your computer and use it in GitHub Desktop.
Streaming external program output in elixir
from sys import argv
from time import sleep
defaults = [
"Output",
30,
.25
]
for index, arg in enumerate(argv[1:]):
defaults[index] = arg
print "Executing with options %s" % defaults
text = defaults[0]
num = int(defaults[1])
seconds = float(defaults[2])
for i in range(0,num):
print "%s %d" % (text, i)
sleep(seconds)
System.cmd "python", ["-u", "long_run.py"], into: IO.stream(:stdio, :line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment