Skip to content

Commit 1985ad1

Browse files
committed
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.
1 parent 6f67b10 commit 1985ad1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mesonbuild/mdevenv.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from pathlib import Path
1111
from . import build, minstall
12-
from .mesonlib import (EnvironmentVariables, MesonException, is_windows, setup_vsenv,
12+
from .mesonlib import (EnvironmentVariables, MesonException, join_args, is_windows, setup_vsenv,
1313
get_wine_shortpath, MachineChoice, relpath)
1414
from .options import OptionKey
1515
from . import mlog
@@ -226,10 +226,9 @@ def run(options: argparse.Namespace) -> int:
226226
args[0] = abs_path or args[0]
227227

228228
try:
229-
return subprocess.call(args, close_fds=False,
230-
env=devenv,
231-
cwd=workdir)
232-
except subprocess.CalledProcessError as e:
233-
return e.returncode
229+
os.chdir(workdir)
230+
os.execvpe(args[0], args, env=devenv)
234231
except FileNotFoundError:
235232
raise MesonException(f'Command not found: {args[0]}')
233+
except OSError as e:
234+
raise MesonException(f'Command `{join_args(args)}` failed to execute: {e}')

0 commit comments

Comments
 (0)