From aac7f6ef1f1c1b5e8e1a296181f76eff203ef284 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 28 May 2016 23:04:15 +0300 Subject: [PATCH] Since we only care about shebang line and sane ones use plain ASCII, use an encoding that can not fail. Closes #561. --- mesonbuild/scripts/meson_install.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index 07fb83b82..1065d0a94 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -110,7 +110,7 @@ def run_install_script(d): print('Running custom install script %s' % script) suffix = os.path.splitext(script)[1].lower() if platform.system().lower() == 'windows' and suffix != '.bat': - first_line = open(script).readline().strip() + first_line = open(script, encoding='latin_1', errors='ignore').readline().strip() if first_line.startswith('#!'): if shutil.which(first_line[2:]): commands = [first_line[2:]] @@ -118,7 +118,6 @@ def run_install_script(d): commands = first_line[2:].split('#')[0].strip().split() commands[0] = shutil.which(commands[0].split('/')[-1]) if commands[0] is None: - commands raise RuntimeError("Don't know how to run script %s." % script) final_command = commands + [script] + i.cmd_arr[1:] else: