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

Howard B. Golden howard_b_golden@yahoo.com
Sun, 23 Jul 2000 13:29:35 -0700 (PDT)

Tim Peters wrote:
> [Mark Hammond]
> > I'm afraid there is a backwards compatibility issue here. 
> Existing
> > code that uses a command.com builtin command will break.
> Indeed, Tcl contains thousands of lines of miserable Win-specific
> code
> trying to make their version of "system" work correctly.  It's A
> Project!

So it can be done, but it's not a simple fix, because you have to
distinguish between command.com builtin commands and external
commands.  I'll look at Tcl to see what's involved.  It sounds like
it's far more trouble than it's worth!  It is my "wish" to clean up
MS's design glitches, but I guess they put them there for a reason
(incompatibility, perhaps?).

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

I'll check.

> IIRC, the correct exit code comes back in NT too -- a command.com
> vs cmd.exe
> thing (command.com *always* returns a 0 exit code).

I had this problem on NT 4.0, too (presumably with cmd.exe).  I'll
double check.

> MS's "system"
> does
> return the exit code of the thing it spawns, so it's the command
> shell that
> screws us, not Python's or MS's implementation of "system".  The
> easiest fix
> is to buy a "real shell" and set COMSPEC to point to it (the MS
> system uses
> COMSPEC to figure out which shell to spawn).

Buying a "real shell" is a great idea, in general, but it doesn't fix
the problem on Windows in general, unless you can get everyone to buy
the shell, too.

Thanks to you both for considering the suggestion!


Do You Yahoo!?
Get Yahoo! Mail  Free email you can access from anywhere!