diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-07-01 18:12:30 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-07-01 18:12:30 +0300 |
commit | c0c2c35496f2832fee7623ec268e87e23b58a33f (patch) | |
tree | 0a6b20c2671b71fe9febfcf0c19cfe22ec980a70 /interpreter.py | |
parent | e5443493bf348993378e1dc59cafde315f851d9b (diff) | |
download | meson-c0c2c35496f2832fee7623ec268e87e23b58a33f.zip meson-c0c2c35496f2832fee7623ec268e87e23b58a33f.tar.gz meson-c0c2c35496f2832fee7623ec268e87e23b58a33f.tar.bz2 |
Windows command execution works.
Diffstat (limited to 'interpreter.py')
-rw-r--r-- | interpreter.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/interpreter.py b/interpreter.py index 0be909a..15f05cd 100644 --- a/interpreter.py +++ b/interpreter.py @@ -17,7 +17,7 @@ import nodes import environment import coredata import dependencies -import os, sys, platform, copy, subprocess +import os, sys, platform, copy, subprocess, shutil class InterpreterException(coredata.MesonException): pass @@ -57,8 +57,13 @@ class RunProcess(InterpreterObject): return subprocess.Popen(command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE) except FileNotFoundError: pass - # Was not a command, try to run as a script relative to current dir. - fullpath = os.path.join(curdir, command_array[0]) + # Was not a command, is a program in path? + exe = shutil.which(cmd_name) + if exe is not None: + command_array = [exe] + command_array[1:] + return subprocess.Popen(command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # No? Maybe it is a script in the source tree. + fullpath = os.path.join(curdir, cmd_name) command_array = [fullpath] + command_array[1:] try: return subprocess.Popen(command_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |