diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2004-03-29 15:52:29 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2004-03-29 15:52:29 +0000 |
commit | b51513377fd4619784f1fa1748037bb7318c81a1 (patch) | |
tree | a340ca7dfe5570a45e8d726702250378cd82ab0f /scipy_distutils/exec_command.py | |
parent | 406a04b80cbdfdc457a1723a64c8cc5a8050aaa7 (diff) | |
download | numpy-b51513377fd4619784f1fa1748037bb7318c81a1.tar.gz |
Fixed exec_command for commands with spaces
Diffstat (limited to 'scipy_distutils/exec_command.py')
-rw-r--r-- | scipy_distutils/exec_command.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scipy_distutils/exec_command.py b/scipy_distutils/exec_command.py index 8ae0eb44a..e3ffff9ee 100644 --- a/scipy_distutils/exec_command.py +++ b/scipy_distutils/exec_command.py @@ -144,10 +144,11 @@ def find_executable(exe, path=None): for path in paths: fn = os.path.join(path,exe) for s in suffices: - f_ext = fn+s + f_ext = os.path.realpath(fn+s) if os.path.isfile(f_ext) and os.access(f_ext,os.X_OK): log.debug('Found executable %s' % f_ext) return f_ext + exe = os.path.realpath(exe) if not os.path.isfile(exe) or os.access(exe,os.X_OK): log.warn('Could not locate executable %s' % exe) return exe @@ -364,10 +365,11 @@ def _exec_command( command, use_shell=None, **env ): argv[0] = find_executable(argv[0]) if not os.path.isfile(argv[0]): log.warn('Executable %s does not exist' % (argv[0])) - if os.name in ['nt','dos']: - # argv[0] might be internal command - argv = [os.environ['COMSPEC'],'/C']+argv - using_command = 1 + argv[0] = quote_arg(argv[0]) + if os.name in ['nt','dos']: + # argv[0] might be internal command + argv = [os.environ['COMSPEC'],'/C']+argv + using_command = 1 # sys.__std*__ is used instead of sys.std* because environments # like IDLE, PyCrust, etc overwrite sys.std* commands. so_fileno = sys.__stdout__.fileno() @@ -394,10 +396,8 @@ def _exec_command( command, use_shell=None, **env ): else: os.dup2(fout.fileno(),se_fileno) - argv0 = quote_arg(argv[0]) - try: - status = spawn_command(os.P_WAIT,argv0,argv,os.environ) + status = spawn_command(os.P_WAIT,argv[0],argv,os.environ) except OSError,errmess: status = 999 sys.stderr.write('%s: %s'%(errmess,argv[0])) |