def shell(command, **kwargs):
b_stdoutflush       = False<EOL>b_stderrflush       = False<EOL>b_waitForChild      = True<EOL>for key, val in kwargs.items():<EOL><INDENT>if key == '<STR_LIT>':        b_stdoutflush   = val<EOL>if key == '<STR_LIT>':        b_stderrflush   = val<EOL>if key == '<STR_LIT>':       b_waitForChild  = val<EOL><DEDENT>child = popen2.Popen3(command, <NUM_LIT:1>) <EOL>child.tochild.close()             <EOL>outfile = child.fromchild<EOL>outfd = outfile.fileno()<EOL>errfile = child.childerr<EOL>errfd = errfile.fileno()<EOL>makeNonBlocking(outfd)            <EOL>makeNonBlocking(errfd)<EOL>outdata = errdata = '<STR_LIT>'<EOL>outeof = erreof = <NUM_LIT:0><EOL>while b_waitForChild:<EOL><INDENT>ready = select.select([outfd,errfd],[],[]) <EOL>if outfd in ready[<NUM_LIT:0>]:<EOL><INDENT>outchunk = outfile.read()<EOL>if b_stdoutflush: sys.stdout.write(outchunk)<EOL>if outchunk == '<STR_LIT>': outeof = <NUM_LIT:1><EOL>outdata = outdata + outchunk<EOL><DEDENT>if errfd in ready[<NUM_LIT:0>]:<EOL><INDENT>errchunk = errfile.read()<EOL>if b_stderrflush: sys.stderr.write(errchunk)<EOL>if errchunk == '<STR_LIT>': erreof = <NUM_LIT:1><EOL>errdata = errdata + errchunk<EOL><DEDENT>if outeof and erreof: break<EOL>select.select([],[],[],<NUM_LIT>) <EOL><DEDENT>err = child.wait()<EOL>return outdata, errdata, err<EOL>
Runs 'command' on the underlying shell and keeps the stdout and
stderr stream separate.

Returns [stdout, stderr, exitCode]