File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 66import shutil
77import sys
88import itertools
9+ import signal
910import typing as T
1011
1112from pathlib import Path
@@ -232,6 +233,26 @@ def run(options: argparse.Namespace) -> int:
232233 tmprc .flush ()
233234 args .append ("--rcfile" )
234235 args .append (tmprc .name )
236+ elif args [0 ].endswith ('fish' ):
237+ # Ignore SIGINT while using fish as the shell to make it behave
238+ # like other shells such as bash and zsh.
239+ # See: https://gitlab.freedesktop.org/gstreamer/gst-build/issues/18
240+ signal .signal (signal .SIGINT , lambda _ , __ : True )
241+ if prompt_prefix :
242+ args .append ('--init-command' )
243+ prompt_cmd = f'''functions --copy fish_prompt original_fish_prompt
244+ function fish_prompt
245+ echo -n '[{ prompt_prefix } ] '(original_fish_prompt)
246+ end'''
247+ args .append (prompt_cmd )
248+ elif args [0 ].endswith ('zsh' ):
249+ # Let the GC remove the tmp file
250+ tmpdir = tempfile .TemporaryDirectory ()
251+ with open (os .path .join (tmpdir .name , '.zshrc' ), 'w' ) as zshrc : # pylint: disable=unspecified-encoding
252+ zshrc .write ('[ -e ~/.zshrc ] && . ~/.zshrc\n ' )
253+ if prompt_prefix :
254+ zshrc .write (f'export PROMPT="[{ prompt_prefix } ] $PROMPT"\n ' )
255+ devenv ['ZDOTDIR' ] = tmpdir .name
235256 if 'DYLD_LIBRARY_PATH' in devenv and macos_sip_enabled ():
236257 mlog .warning ('macOS System Integrity Protection is enabled: DYLD_LIBRARY_PATH cannot be set in the subshell' )
237258 mlog .warning ('To fix that, use `meson devenv --dump dev.env && source dev.env`' )
You can’t perform that action at this time.
0 commit comments