aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-11-30 22:21:24 +0200
committerGitHub <noreply@github.com>2017-11-30 22:21:24 +0200
commitecba22965d438e94a260c6c5d00a034a8d144904 (patch)
tree8fa281eded8de63936909b93f744a2edc377c499 /mesonbuild
parent8b5d4661614eb9f09143ad9da1c70e7c48a41101 (diff)
parent12238725135f5494e9dc53830f4151d85d25f1eb (diff)
downloadmeson-ecba22965d438e94a260c6c5d00a034a8d144904.zip
meson-ecba22965d438e94a260c6c5d00a034a8d144904.tar.gz
meson-ecba22965d438e94a260c6c5d00a034a8d144904.tar.bz2
Merge pull request #2708 from mesonbuild/nirbheek/windows-shebang-parsing
dependencies: Fix parsing of shebangs with spaces
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 682182c..a720232 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -560,7 +560,11 @@ class ExternalProgram:
with open(script) as f:
first_line = f.readline().strip()
if first_line.startswith('#!'):
- commands = first_line[2:].split('#')[0].strip().split()
+ # In a shebang, everything before the first space is assumed to
+ # be the command to run and everything after the first space is
+ # the single argument to pass to that command. So we must split
+ # exactly once.
+ commands = first_line[2:].split('#')[0].strip().split(maxsplit=1)
if mesonlib.is_windows():
# Windows does not have UNIX paths so remove them,
# but don't remove Windows paths