summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-11-08 16:18:57 -0500
committerEli Schwartz <eschwartz93@gmail.com>2024-11-17 00:29:09 -0500
commit1985ad19cb69f6db1d7e2e0c89fa6796782bfd43 (patch)
tree9c7dcee78caf255072ab8294ee1d73182e685f0b
parent6f67b10e0823e864610e3adae028a56400c07043 (diff)
downloadmeson-1985ad19cb69f6db1d7e2e0c89fa6796782bfd43.tar.gz
mdevenv: exec directly into the program to run
We don't need an extra process in the process tree (specifically the `meson devenv` process itself). Aside for the redundancy, it's actively problematic if you abort a program in the devenv by using CTRL+C, as meson itself will then emit a traceback (KeyboardInterrupt) which is quite ugly.
-rw-r--r--mesonbuild/mdevenv.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py
index 064cf5ed6..8c6ce2031 100644
--- a/mesonbuild/mdevenv.py
+++ b/mesonbuild/mdevenv.py
@@ -9,7 +9,7 @@ import typing as T
from pathlib import Path
from . import build, minstall
-from .mesonlib import (EnvironmentVariables, MesonException, is_windows, setup_vsenv,
+from .mesonlib import (EnvironmentVariables, MesonException, join_args, is_windows, setup_vsenv,
get_wine_shortpath, MachineChoice, relpath)
from .options import OptionKey
from . import mlog
@@ -226,10 +226,9 @@ def run(options: argparse.Namespace) -> int:
args[0] = abs_path or args[0]
try:
- return subprocess.call(args, close_fds=False,
- env=devenv,
- cwd=workdir)
- except subprocess.CalledProcessError as e:
- return e.returncode
+ os.chdir(workdir)
+ os.execvpe(args[0], args, env=devenv)
except FileNotFoundError:
raise MesonException(f'Command not found: {args[0]}')
+ except OSError as e:
+ raise MesonException(f'Command `{join_args(args)}` failed to execute: {e}')