diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py index 344f8d785d05..7451c2242a56 100644 --- a/mesonbuild/mdevenv.py +++ b/mesonbuild/mdevenv.py @@ -6,7 +6,6 @@ import shutil import sys import itertools -import signal import typing as T from pathlib import Path @@ -224,7 +223,7 @@ def run(options: argparse.Namespace) -> int: args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))] if "bash" in args[0]: # Let the GC remove the tmp file - tmprc = tempfile.NamedTemporaryFile(mode='w') + tmprc = tempfile.NamedTemporaryFile(mode='w', encoding='utf-8') tmprc.write('[ -e ~/.bashrc ] && . ~/.bashrc\n') if prompt_prefix: tmprc.write(f'export PS1="{prompt_prefix} $PS1"\n') @@ -233,25 +232,13 @@ 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 + with open(os.path.join(tmpdir.name, '.zshrc'), 'w', encoding='utf-8') as zshrc: zshrc.write('[ -e ~/.zshrc ] && . ~/.zshrc\n') if prompt_prefix: - zshrc.write(f'export PROMPT="[{prompt_prefix}] $PROMPT"\n') + 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')