[Python-bugs-list] "Fix" os.system() on Windows (PR#406)

Mark Hammond mhammond@skippinet.com.au
Sun, 23 Jul 2000 13:46:02 +1000

> To make os.system() on Windows work like os.system() on Unix (a
> Good Idea-TM),
> implement os.system on Windows using code similar to what was
> suggested by Cary
> Evans in
> http://www.python.org/pipermail/python-list/1999-May/009409.html .

I'm afraid there is a backwards compatibility issue here.  Existing code
that uses a command.com builtin command will break.  Eg, the following code
works now, but would not work with the proposed patch.

os.system("copy whatever somewhereelse")

> (Note: It seems to me that this change is consistent with the
> recent change to
> posixmodule.c to make os.popen() work the same on Windows as Unix.)

I agree in principle - however, any fix must not break existing code.

Interestingly, this bug in Windows appears to be fixed in Windows 2000.

>>> os.system('python.exe -c "import sys;sys.exit(2)')
'python.exe' is not recognized as an internal or external command,
operable program or batch file.
>>> os.system('\\src\\python-cvs\\pcbuild\\python.exe -c "import
>>> os.system('\\src\\python-cvs\\pcbuild\\python.exe -c "import