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
@@ -224,6 +225,26 @@ def run(options: argparse.Namespace) -> int:
224225 tmprc .flush ()
225226 args .append ("--rcfile" )
226227 args .append (tmprc .name )
228+ elif args [0 ].endswith ('fish' ):
229+ # Ignore SIGINT while using fish as the shell to make it behave
230+ # like other shells such as bash and zsh.
231+ # See: https://gitlab.freedesktop.org/gstreamer/gst-build/issues/18
232+ signal .signal (signal .SIGINT , lambda _ , __ : True )
233+ if prompt_prefix :
234+ args .append ('--init-command' )
235+ prompt_cmd = f'''functions --copy fish_prompt original_fish_prompt
236+ function fish_prompt
237+ echo -n '[{ prompt_prefix } ] '(original_fish_prompt)
238+ end'''
239+ args .append (prompt_cmd )
240+ elif args [0 ].endswith ('zsh' ):
241+ # Let the GC remove the tmp file
242+ tmpdir = tempfile .TemporaryDirectory ()
243+ with open (os .path .join (tmpdir .name , '.zshrc' ), 'w' , encoding = 'utf-8' ) as zshrc :
244+ zshrc .write ('[ -e ~/.zshrc ] && . ~/.zshrc\n ' )
245+ if prompt_prefix :
246+ zshrc .write (f'export PROMPT="[{ prompt_prefix } ] $PROMPT"\n ' )
247+ devenv ['ZDOTDIR' ] = tmpdir .name
227248 else :
228249 # Try to resolve executable using devenv's PATH
229250 abs_path = shutil .which (args [0 ], path = devenv .get ('PATH' , None ))
You can’t perform that action at this time.
0 commit comments