[Patches] [ python-Patches-466451 ] popen fix for multiple quoted arguments
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 30 Sep 2001 11:46:28 -0700
Patches item #466451, was opened at 2001-09-29 17:34
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=466451&group_id=5470
Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Quinlan (bquinlan)
>Assigned to: Tim Peters (tim_one)
Summary: popen fix for multiple quoted arguments
Initial Comment:
In a Windows version of Python, try the following:
os.popen('"<path-of-exe" "path-of-arg"'>.read()
cmd.exe will misinterpret the command string because
it strips the first and last quote in the command
string (cmd.exe /? for details).
This patch does a few things:
1. it encloses the command string sent to cmd.exe in
quotes and uses the /S switch
2. if the shell is not command.com or cmd.exe, it
passes the -c switch to the shell (this makes popen
work if the user's shell is bash, sh, etc.)
3. changes the variables s1, s2 and s3 to cmdPath,
completeCmd and cmdArgs
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-30 11:46
Message:
Logged In: YES
user_id=6380
Tim, whaddayathink? Or is this for Mark?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=466451&group_id=5470