From 0a5e96aafef80b809f46c431ce688b6c00fa236d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 27 Jul 2021 14:27:45 -0700 Subject: scripts/meson_exe: close fd if we open it --- mesonbuild/scripts/meson_exe.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index 9c1ae596c..cd3534cb0 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -67,6 +67,9 @@ def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[dict] = None) -> close_fds=False, stdin=stdin, stdout=pipe, stderr=pipe) stdout, stderr = p.communicate() + if stdin is not None: + stdin.close() + if p.returncode == 0xc0000135: # STATUS_DLL_NOT_FOUND on Windows indicating a common problem that is otherwise hard to diagnose raise FileNotFoundError('due to missing DLLs') -- cgit v1.2.3 From e4f4b76ddbc2c37b14aac69a043cc878947caa49 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 27 Jul 2021 14:31:01 -0700 Subject: scripts/meson_exe: narrow type annotation Not just a `dict`, but a `dict[str, str]` --- mesonbuild/scripts/meson_exe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index cd3534cb0..dc89876be 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -32,7 +32,7 @@ def buildparser() -> argparse.ArgumentParser: parser.add_argument('--feed') return parser -def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[dict] = None) -> int: +def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[T.Dict[str, str]] = None) -> int: if exe.exe_runner: if not exe.exe_runner.found(): raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found ' -- cgit v1.2.3