diff options
Diffstat (limited to 'scipy_distutils/exec_command.py')
-rw-r--r-- | scipy_distutils/exec_command.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scipy_distutils/exec_command.py b/scipy_distutils/exec_command.py index 8a3e2e6db..72ffdc5e3 100644 --- a/scipy_distutils/exec_command.py +++ b/scipy_distutils/exec_command.py @@ -329,6 +329,10 @@ def _exec_command_python(command, return status, text +def quote_arg(arg): + if arg[0]!='"' and ' ' in arg: + return '"%s"' % arg + return arg def _exec_command( command, use_shell=None, **env ): log.debug('_exec_command(...)') @@ -390,9 +394,7 @@ def _exec_command( command, use_shell=None, **env ): else: os.dup2(fout.fileno(),se_fileno) - argv0 = argv[0] - if ' ' in argv[0]: - argv[0] = '"%s"' % (argv[0]) + argv0 = quote_arg(argv[0]) try: status = spawn_command(os.P_WAIT,argv0,argv,os.environ) |