This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: make commands.getstatusoutput work on windows
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: atotic, jlgijsbers
Priority: normal Keywords: patch

Created on 2002-12-31 20:24 by atotic, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (2)
msg42161 - (view) Author: Aleksandar Totic (atotic) Date: 2002-12-31 20:24
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.
msg42162 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-15 13:15
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.
History
Date User Action Args
2022-04-10 16:06:04adminsetgithub: 37672
2002-12-31 20:24:40atoticcreate