Created
December 1, 2012 22:47
-
-
Save dbrgn/4185712 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
from subprocess import Popen, PIPE, STDOUT | |
import time | |
def process_line(line): | |
print 'New line: "%s"' % line.strip('\n') | |
proc = Popen(['bash', 'print_lines.sh'], stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) | |
while True: | |
line = proc.stdout.readline() | |
if line != '': | |
process_line(line) | |
else: | |
break |
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
echo "Line 1" | |
sleep 1 | |
echo "Line 2" 1>&2; | |
sleep 1 | |
echo "Line 3" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment