On 12/18/2009 8:15 AM, Chris Withers wrote:
the order of the writes isn't preserved.
How can I get this to be the case?
You'll need to flush the std{out|err} or set them unbuffered; or you can
just forget about relying on std{out|err} being ordered per write-order.
--
Hi All,
I have this simple function:
def execute(command):
process = Popen(command.split(),stderr=STDOUT,stdout=PIPE)
return process.communicate()[0]
..but my unit test for it fails:
from testfixtures import tempdir,compare
from unittest import TestCase
class TestExecute(TestCase):
On 09:15 pm, ch...@simplistix.co.uk wrote:
Hi All,
I have this simple function:
def execute(command):
process = Popen(command.split(),stderr=STDOUT,stdout=PIPE)
return process.communicate()[0]
..but my unit test for it fails:
from testfixtures import tempdir,compare
from unittest
exar...@twistedmatrix.com wrote:
How can I get this to be the case?
You probably just need to flush stdout and stderr after each write. You
set them up to go to the same underlying file descriptor, but they still
each have independent buffering on top of that.
Okay, but if I do:
On 09:56 pm, ch...@simplistix.co.uk wrote:
exar...@twistedmatrix.com wrote:
How can I get this to be the case?
You probably just need to flush stdout and stderr after each write.
You set them up to go to the same underlying file descriptor, but they
still each have independent buffering on
exar...@twistedmatrix.com wrote:
libc is probably giving you line buffering when you use os.system
(because the child process inherits the parent's stdio, and the parent's
stdio is probably a pty, and that's the policy libc implements).
snip
Interesting, but do these assertions still hold
On 18/12/2009 9:33 AM, Chris Withers wrote:
exar...@twistedmatrix.com wrote:
libc is probably giving you line buffering when you use os.system
(because the child process inherits the parent's stdio, and the
parent's stdio is probably a pty, and that's the policy libc implements).
snip
On 12/17/2009 5:33 PM, Chris Withers wrote:
exar...@twistedmatrix.com wrote:
libc is probably giving you line buffering when you use os.system
(because the child process inherits the parent's stdio, and the
parent's stdio is probably a pty, and that's the policy libc implements).
snip