Skip to content

Instantly share code, notes, and snippets.

@marten
Created July 18, 2014 09:35
Show Gist options
  • Save marten/917ba962be3a34b20d4f to your computer and use it in GitHub Desktop.
Save marten/917ba962be3a34b20d4f to your computer and use it in GitHub Desktop.
import subprocess
import sys
import time
proc = subprocess.Popen(['/Users/marten/.rubies/ruby-2.1.1/bin/ruby', '/Users/marten/tmp/python-processes/slave.rb'],
stdin=subprocess.PIPE, stdout=sys.stdout)
for i in range(5):
print "Python preparing to send newline"
proc.stdin.write("\n")
time.sleep(1)
puts "Ruby started"
while line = gets
puts "Ruby[#{Process.pid}]: Got a line!"
puts "Ruby[#{Process.pid}]: /tmp/foo.png"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment