diff --git a/gui/Scyther/Misc.py b/gui/Scyther/Misc.py index e3958a9..6e07098 100644 --- a/gui/Scyther/Misc.py +++ b/gui/Scyther/Misc.py @@ -93,21 +93,19 @@ def getShell(): """ Determine if we want a shell for Popen """ - if sys.platform.startswith("win"): - shell=False - else: - # Needed to handle the string input correctly (as opposed to a sequence where the first element is the executable) - # This is not needed on Windows, where it has a different effect altogether. - # See http://docs.python.org/library/subprocess.html?highlight=subprocess#module-subprocess - shell=True - return shell + return False def safeCommandOutput(cmd, storePopen=None): """ Execute a command and return (sts,sout,serr). Meant for short outputs, as output is stored in memory and not written to a file. """ - p = Popen(cmd, shell=getShell(), stdout=PIPE, stderr=PIPE) + + if isinstance(cmd, str): + import shlex + cmd = shlex.split(cmd) + + p = Popen(cmd, stdout=PIPE, stderr=PIPE) if storePopen != None: storePopen(p) (sout,serr) = p.communicate() @@ -119,7 +117,11 @@ def safeCommand(cmd, storePopen=None): version, I hope. """ try: - p = Popen(cmd, shell=getShell()) + if isinstance(cmd, str): + import shlex + cmd = shlex.split(cmd) + + p = Popen(cmd) if storePopen != None: storePopen(p) sts = p.wait()