From d6d7eb87045287aec01a5e74ccecb142a1e3062e Mon Sep 17 00:00:00 2001 From: hpk Date: Sat, 3 Feb 2007 13:31:47 +0100 Subject: [PATCH] [svn r37866] small cleanup of ground std* descriptors. --HG-- branch : trunk --- py/execnet/register.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/py/execnet/register.py b/py/execnet/register.py index 40e5885ca..4bc382688 100644 --- a/py/execnet/register.py +++ b/py/execnet/register.py @@ -171,16 +171,19 @@ def stdouterrin_setnull(): devnull = 'NUL' else: devnull = '/dev/null' + # stdin sys.stdin = os.fdopen(os.dup(0), 'rb', 0) - sys.stdout = os.fdopen(os.dup(1), 'wb', 0) - if os.name == 'nt': - sys.stderr = os.fdopen(os.dup(2), 'wb', 0) fd = os.open(devnull, os.O_RDONLY) os.dup2(fd, 0) os.close(fd) + + # stdout + sys.stdout = os.fdopen(os.dup(1), 'wb', 0) fd = os.open(devnull, os.O_WRONLY) os.dup2(fd, 1) + + # stderr for win32 if os.name == 'nt': + sys.stderr = os.fdopen(os.dup(2), 'wb', 0) os.dup2(fd, 2) os.close(fd) -