diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-23 10:58:26 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-06-29 20:54:13 +0300 |
commit | 1f3adc4dbe20196eb45b7c0cfe502ce108618ada (patch) | |
tree | 60771f94cfca0c0761a95eafa584c83f478edeaa /mesonbuild/scripts | |
parent | 4bfee181c5a166e3d429bd265e06d299dce50f30 (diff) | |
download | meson-1f3adc4dbe20196eb45b7c0cfe502ce108618ada.zip meson-1f3adc4dbe20196eb45b7c0cfe502ce108618ada.tar.gz meson-1f3adc4dbe20196eb45b7c0cfe502ce108618ada.tar.bz2 |
Add feed arg to custom_target()
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/meson_exe.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index ea0fef6..9c1ae59 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -29,6 +29,7 @@ def buildparser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(description='Custom executable wrapper for Meson. Do not run on your own, mmm\'kay?') parser.add_argument('--unpickle') parser.add_argument('--capture') + parser.add_argument('--feed') return parser def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[dict] = None) -> int: @@ -53,13 +54,17 @@ def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[dict] = None) -> ['Z:' + p for p in exe.extra_paths] + child_env.get('WINEPATH', '').split(';') ) + stdin = None + if exe.feed: + stdin = open(exe.feed, 'rb') + pipe = subprocess.PIPE if exe.verbose: assert not exe.capture, 'Cannot capture and print to console at the same time' pipe = None p = subprocess.Popen(cmd_args, env=child_env, cwd=exe.workdir, - close_fds=False, stdout=pipe, stderr=pipe) + close_fds=False, stdin=stdin, stdout=pipe, stderr=pipe) stdout, stderr = p.communicate() if p.returncode == 0xc0000135: @@ -103,13 +108,13 @@ def run(args: T.List[str]) -> int: if not options.unpickle and not cmd_args: parser.error('either --unpickle or executable and arguments are required') if options.unpickle: - if cmd_args or options.capture: + if cmd_args or options.capture or options.feed: parser.error('no other arguments can be used with --unpickle') with open(options.unpickle, 'rb') as f: exe = pickle.load(f) exe.pickled = True else: - exe = ExecutableSerialisation(cmd_args, capture=options.capture) + exe = ExecutableSerialisation(cmd_args, capture=options.capture, feed=options.feed) return run_exe(exe) |