[Python-Dev] test_popen broken on Win2K
Fri, 07 Mar 2003 17:16:21 -0500
> Having to quote arguments to popen and system is a pet peave of mine.
> 99% of the time I don't not want or need the shell. Is it possible to
> write versions of system() and popen() that do not use the shell on
> Windows? I know it's possible on Unix systems. It would be really nice
> if both popen() and system() could take a sequence for the command and
> arguments in addition to a string.
Those would be quite different functions, then, unless you proposed to have
Python interpret native shell metacharacters on its own too (e.g., set up
pipes, do the indicated file redirections, interpolate envars, and fake
whatever other shell gimmicks people may use).
The spawn family of functions take a list of arguments and are sometimes
more convenient. IIRC, though, on Windows the MS spawn implementation
pastes them back into a cmdline, and then you get some *really* bizarre
I always thought Tcl's "exec" cmd was worthy of stealing. That defines a
sh-like syntax for specifying OS commands, but arranges to interpret them
the same way on all platforms (so, e.g, "2>&1" redirects stderr to stdout
even on Win95; last I looked, there were thousands of lines in the Tcl
implementation devoted to making this command work).