diff options
| -rw-r--r-- | mesonbuild/mdevenv.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py index bb110c597..344f8d785 100644 --- a/mesonbuild/mdevenv.py +++ b/mesonbuild/mdevenv.py @@ -6,6 +6,7 @@ import tempfile import shutil import sys import itertools +import signal import typing as T from pathlib import Path @@ -232,6 +233,26 @@ def run(options: argparse.Namespace) -> int: tmprc.flush() args.append("--rcfile") args.append(tmprc.name) + elif args[0].endswith('fish'): + # Ignore SIGINT while using fish as the shell to make it behave + # like other shells such as bash and zsh. + # See: https://gitlab.freedesktop.org/gstreamer/gst-build/issues/18 + signal.signal(signal.SIGINT, lambda _, __: True) + if prompt_prefix: + args.append('--init-command') + prompt_cmd = f'''functions --copy fish_prompt original_fish_prompt + function fish_prompt + echo -n '[{prompt_prefix}] '(original_fish_prompt) + end''' + args.append(prompt_cmd) + elif args[0].endswith('zsh'): + # Let the GC remove the tmp file + tmpdir = tempfile.TemporaryDirectory() + with open(os.path.join(tmpdir.name, '.zshrc'), 'w') as zshrc: # pylint: disable=unspecified-encoding + zshrc.write('[ -e ~/.zshrc ] && . ~/.zshrc\n') + if prompt_prefix: + zshrc.write(f'export PROMPT="[{prompt_prefix}] $PROMPT"\n') + devenv['ZDOTDIR'] = tmpdir.name if 'DYLD_LIBRARY_PATH' in devenv and macos_sip_enabled(): mlog.warning('macOS System Integrity Protection is enabled: DYLD_LIBRARY_PATH cannot be set in the subshell') mlog.warning('To fix that, use `meson devenv --dump dev.env && source dev.env`') |
