From d34e53202043abab121ba93fa3922e5b2e4961b8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 12 Jul 2019 17:46:58 +0200 Subject: [PATCH] backends: do not split command and arguments in ExecutableSerialisation This is not needed anymore, just make a single field with the whole command line. --- mesonbuild/backend/backends.py | 5 ++--- mesonbuild/scripts/meson_exe.py | 13 +++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index a334b3444..8c2752a77 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -69,9 +69,8 @@ class TargetInstallData: self.optional = optional class ExecutableSerialisation: - def __init__(self, fname, cmd_args, env=None, exe_wrapper=None, + def __init__(self, cmd_args, env=None, exe_wrapper=None, workdir=None, extra_paths=None, capture=None): - self.fname = fname self.cmd_args = cmd_args self.env = env or {} if exe_wrapper is not None: @@ -384,7 +383,7 @@ class Backend: scratch_file = 'meson_exe_{0}_{1}.dat'.format(basename, digest) exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file) with open(exe_data, 'wb') as f: - es = ExecutableSerialisation(exe_cmd, cmd_args, env, + es = ExecutableSerialisation(exe_cmd + cmd_args, env, exe_wrapper, workdir, extra_paths, capture) pickle.dump(es, f) diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index 8f7d0fd3d..8b34448a5 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -42,10 +42,10 @@ def run_exe(exe): if exe.exe_runner: if not exe.exe_runner.found(): raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found ' - 'wrapper {!r}'.format(exe.fname[0], exe.exe_runner.get_path())) - cmd = exe.exe_runner.get_command() + exe.fname + 'wrapper {!r}'.format(exe.cmd_args[0], exe.exe_runner.get_path())) + cmd_args = exe.exe_runner.get_command() + exe.cmd_args else: - cmd = exe.fname + cmd_args = exe.cmd_args child_env = os.environ.copy() child_env.update(exe.env) if exe.extra_paths: @@ -61,7 +61,7 @@ def run_exe(exe): else: child_env['WINEPATH'] = wine_path - p = subprocess.Popen(cmd + exe.cmd_args, env=child_env, cwd=exe.workdir, + p = subprocess.Popen(cmd_args, env=child_env, cwd=exe.workdir, close_fds=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -103,10 +103,7 @@ def run(args): with open(options.unpickle, 'rb') as f: exe = pickle.load(f) else: - exe_cmd = cmd_args[0] - cmd_args = cmd_args[1:] - exe = ExecutableSerialisation([exe_cmd], cmd_args, - capture=options.capture) + exe = ExecutableSerialisation(cmd_args, capture=options.capture) return run_exe(exe)