Fix #7724
This commit is contained in:
parent
4ab445dc66
commit
4575dc6b70
1 changed files with 14 additions and 5 deletions
|
|
@ -229,6 +229,15 @@ def get_data():
|
|||
move(tdir + '/root', '/')
|
||||
|
||||
|
||||
def exec_with_better_error(*a):
|
||||
try:
|
||||
os.execlp(*a)
|
||||
except OSError as err:
|
||||
if err.errno == errno.ENOENT:
|
||||
raise SystemExit('The program: "' + a[0] + '" was not found')
|
||||
raise
|
||||
|
||||
|
||||
def exec_zsh_with_integration():
|
||||
zdotdir = os.environ.get('ZDOTDIR') or ''
|
||||
if not zdotdir:
|
||||
|
|
@ -240,7 +249,7 @@ def exec_zsh_with_integration():
|
|||
for q in ('.zshrc', '.zshenv', '.zprofile', '.zlogin'):
|
||||
if os.path.exists(os.path.join(zdotdir, q)):
|
||||
os.environ['ZDOTDIR'] = shell_integration_dir + '/zsh'
|
||||
os.execlp(login_shell, os.path.basename(login_shell), '-l')
|
||||
exec_with_better_error(login_shell, os.path.basename(login_shell), '-l')
|
||||
os.environ.pop('KITTY_ORIG_ZDOTDIR', None) # ensure this is not propagated
|
||||
|
||||
|
||||
|
|
@ -250,7 +259,7 @@ def exec_fish_with_integration():
|
|||
else:
|
||||
os.environ['XDG_DATA_DIRS'] = shell_integration_dir + ':' + os.environ['XDG_DATA_DIRS']
|
||||
os.environ['KITTY_FISH_XDG_DATA_DIR'] = shell_integration_dir
|
||||
os.execlp(login_shell, os.path.basename(login_shell), '-l')
|
||||
exec_with_better_error(login_shell, os.path.basename(login_shell), '-l')
|
||||
|
||||
|
||||
def exec_bash_with_integration():
|
||||
|
|
@ -259,7 +268,7 @@ def exec_bash_with_integration():
|
|||
if not os.environ.get('HISTFILE'):
|
||||
os.environ['HISTFILE'] = os.path.join(HOME, '.bash_history')
|
||||
os.environ['KITTY_BASH_UNEXPORT_HISTFILE'] = '1'
|
||||
os.execlp(login_shell, os.path.basename('login_shell'), '--posix')
|
||||
exec_with_better_error(login_shell, os.path.basename('login_shell'), '--posix')
|
||||
|
||||
|
||||
def exec_with_shell_integration():
|
||||
|
|
@ -307,12 +316,12 @@ def main():
|
|||
if exec_cmd:
|
||||
os.environ.pop('KITTY_SHELL_INTEGRATION', None)
|
||||
cmd = base64.standard_b64decode(exec_cmd).decode('utf-8')
|
||||
os.execlp(login_shell, os.path.basename(login_shell), '-c', cmd)
|
||||
exec_with_better_error(login_shell, os.path.basename(login_shell), '-c', cmd)
|
||||
TEST_SCRIPT # noqa
|
||||
if ksi and 'no-rc' not in ksi:
|
||||
exec_with_shell_integration()
|
||||
os.environ.pop('KITTY_SHELL_INTEGRATION', None)
|
||||
os.execlp(login_shell, '-' + os.path.basename(login_shell))
|
||||
exec_with_better_error(login_shell, '-' + os.path.basename(login_shell))
|
||||
|
||||
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue