def _AsynchronouslyGetProcessOutput(formattedCmd, printStdOut, printStdErr, **kwargs):
opts = filterKWArgsForFunc(kwargs, subprocess.Popen)<EOL>opts['<STR_LIT>'] = subprocess.PIPE<EOL>opts['<STR_LIT>'] = subprocess.PIPE<EOL>process = subprocess.Popen(formattedCmd, **opts)<EOL>stdout_queue = queue.Queue()<EOL>stdout_reader = _AsynchronousFileReader(process.stdout, stdout_queue)<EOL>stdout_reader.start()<EOL>stderr_queue = queue.Queue()<EOL>stderr_reader = _AsynchronousFileReader(process.stderr, stderr_queue)<EOL>stderr_reader.start()<EOL>stdOutLines = []<EOL>stdErrLines = []<EOL>while not stdout_reader.eof() or not stderr_reader.eof():<EOL><INDENT>while not stdout_queue.empty():<EOL><INDENT>line = stdout_queue.get()<EOL>stdOutLines.append(line)<EOL>if printStdOut:<EOL><INDENT>print(line.rstrip())<EOL><DEDENT><DEDENT>while not stderr_queue.empty():<EOL><INDENT>line = stderr_queue.get()<EOL>stdErrLines.append(line)<EOL>if printStdErr:<EOL><INDENT>print(colored(line.rstrip(),'<STR_LIT>'))<EOL><DEDENT><DEDENT>time.sleep(<NUM_LIT>)<EOL><DEDENT>stdout_reader.join()<EOL>stderr_reader.join()<EOL>process.stdout.close()<EOL>process.stderr.close()<EOL>process.wait()<EOL>stdOut = '<STR_LIT>'.join(stdOutLines)<EOL>stdErr = '<STR_LIT>'.join(stdErrLines)<EOL>return (process.returncode, stdOut, stdErr)<EOL>
Asynchronously read the process