def run_simple (self, cmds, x, family) :
'''
Run a single command in a subprocess. Line buffer output.
cmds -> A list of commands to be run for this family
x -> The sequence of the command to run
family -> The family that goes with these commands
pee -> The process
fifofh -> File handle to fifo
'''
pee = None
try :
cmd = cmds[x]
except IndexError :
return pee, None
#fifo = os.path.join ("/tmp", "fifo{0}".format (family))
#if not os.path.exists (fifo) :
#os.mkfifo (fifo)
#fifofh = open (fifo, mode='rw+')
pee = subprocess.Popen (cmd,
shell=True,
bufsize=1,
cwd=os.path.join (self.home, family),
stdout=subprocess.PIPE,
universal_newlines=True,
close_fds=ON_POSIX)
fifofh = pee.stdout
return pee, fifofh
评论列表
文章目录