[Patches] [ python-Patches-660505 ] make commands.getstatusoutput work on windows

SourceForge.net noreply at sourceforge.net
Sun Aug 15 15:15:42 CEST 2004


Patches item #660505, was opened at 2002-12-31 21:24
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=660505&group_id=5470

Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Aleksandar Totic (atotic)
Assigned to: Nobody/Anonymous (nobody)
Summary: make commands.getstatusoutput work on windows

Initial Comment:
The following patch makes commands.getstatusoutput 
work on windows NT. Original code:
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')

did not work on window's cmd.exe. This is because 
cmd.exe does not support "{}" command blocks.

To my knowledge, cmd.exe does not support command 
blocks at all. So the patch simply executes the 
command on nt, without any wrapping beyond adding 
redirection.

old code: (r 1.15)
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')

new code:
if (os.name == 'nt'):
    pipe = os.popen(cmd + ' 2>&1', 'r')
else:
    pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')

this is CVS Python source on Dec 31st, 2002, running 
on Windows XP professional.

----------------------------------------------------------------------

>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-08-15 15:15

Message:
Logged In: YES 
user_id=469548

The commands module is going to stay Unix-specific. There
are too many potential issues with trying to support the
various win32 command interpreters. See
http://mail.python.org/pipermail/python-dev/2004-August/047774.html
and its responses.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=660505&group_id=5470


More information about the Patches mailing list