diff --git a/kittens/ssh/main.py b/kittens/ssh/main.py index bd5741baf..1daa82a3d 100644 --- a/kittens/ssh/main.py +++ b/kittens/ssh/main.py @@ -326,7 +326,7 @@ def get_posix_cmd(remote_args: List[str]) -> List[str]: # line 1129 of ssh.c and on the remote side sshd.c runs the # concatenated command as shell -c cmd args = [c.replace("'", """'"'"'""") for c in remote_args] - command_to_execute = "exec $login_shell -c '{}'".format(' '.join(args)) + command_to_execute = "exec \"$login_shell\" -c '{}'".format(' '.join(args)) sh_script = load_script(exec_cmd=command_to_execute) return [f'sh -c {shlex.quote(sh_script)}'] diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index c78e09576..730c5024a 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -213,6 +213,14 @@ execute_with_python() { return 1; } +LOGIN_SHELL="OVERRIDE_LOGIN_SHELL" +if [ -n "$LOGIN_SHELL" ]; then + login_shell="$LOGIN_SHELL" +else + using_getent || using_id || using_python || using_passwd || die "Could not detect login shell"; +fi +shell_name=$(basename $login_shell) + # If a command was passed to SSH execute it here EXEC_CMD @@ -224,13 +232,6 @@ if [ "$tty_ok" = "n" ]; then fi fi -LOGIN_SHELL="OVERRIDE_LOGIN_SHELL" -if [ -n "$LOGIN_SHELL" ]; then - login_shell="$LOGIN_SHELL" -else - using_getent || using_id || using_python || using_passwd || die "Could not detect login shell"; -fi -shell_name=$(basename $login_shell) exec_bash_with_integration() { export ENV="$shell_integration_dir/bash/kitty.bash"