Skip to content

Instantly share code, notes, and snippets.

@kracekumar
Created March 27, 2011 18:28
Show Gist options
  • Save kracekumar/889439 to your computer and use it in GitHub Desktop.
Save kracekumar/889439 to your computer and use it in GitHub Desktop.
#child.py
#! /usr/bin/env python
import subprocess
import sys
try:
processes=int(raw_input("NO of child process:"))
pid_list=[]
for x in xrange(processes+1):
text="echo " + str(x)
echo=subprocess.Popen(text,stdout=subprocess.PIPE,shell=True,stdin=subprocess.PIPE)
spawned_process=subprocess.Popen(["python"," get_input.py"],shell=True,stdin=echo.stdout,stdout=subprocess.PIPE)
pid_list.append(spawned_process.pid)
print spawned_process.stdout.readline()
# print pid_list
# sys.stdin.write(pid_list)
except ValueError:
print "expects int "
#get_input.py
#! /usr/bin/env python
import sys
k=raw_input()
k=sys.stdin.readlines()
print "krace"
print k
the problem is i am unable to get get_input.py o/p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment