# HG changeset patch # User Jeff Hammel # Date 1391368611 28800 # Node ID 567492ef7b57355e8c8fabe50b9bc55f168cd484 # Parent 5b561c7b2005c2a72b76b075d30fab0a821e1bfc STUB: python/multiproc.py diff -r 5b561c7b2005 -r 567492ef7b57 python/multiproc.py --- a/python/multiproc.py Sun Feb 02 11:07:04 2014 -0800 +++ b/python/multiproc.py Sun Feb 02 11:16:51 2014 -0800 @@ -27,6 +27,11 @@ _kwargs = self.defaults.copy() _kwargs.update(kwargs) + # on unix, ``shell={True|False}`` should always come from the + # type of command (string or list) + if not mswindows: + _kwargs['shell'] = isinstance(command, string) + # output buffer self.output_buffer = tempfile.SpooledTemporaryFile() self.location = 0 @@ -35,7 +40,7 @@ # launch subprocess self.start = time.time() - subprocess.Popen.__init__(self, *args, **_kwargs) + subprocess.Popen.__init__(self, command, **_kwargs) def wait(self, maxtime=None, sleep=1.): """ @@ -51,14 +56,15 @@ # TODO: read from output return process.kill() + # read from output buffer + self.output_buffer.seek(self.location) + read = self.output_buffer.read() + self.location += len(read) + # naptime if sleep: time.sleep(sleep) - # read from output buffer - self.output_buffer.seek(self.location) - read = self.output_buffer.read() - self.location += len(read) def commandline(self): """returns string of command line"""