Skip to content

Commit 710ebbc

Browse files
committed
Don't send the SSH integration control sequences until ssh has connected to the remote host so you can interact with prompts like the unknown host prompt.
1 parent 60718c7 commit 710ebbc

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

utilities/it2ssh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ if [ ! -d ~/.ssh ]; then
5757
chmod 700 ~/.ssh
5858
fi
5959

60-
print_osc
61-
printf "1337;Env=report=all:"
62-
command env | base64_encode
63-
print_st
6460

6561
requote() {
6662
printf "%q " "$@"
@@ -128,16 +124,30 @@ fi
128124
ENCODED_BA=$(printf %s "$BOOLEAN_ARGS" | base64_encode)
129125

130126
# Send arguments to conductor.sh
131-
print_osc
127+
myenv=$(command env | base64_encode)
128+
osc=$(print_osc)
129+
st=$(print_st)
130+
intro=$(
131+
printf "%s" "$osc"
132+
printf "1337;Env=report=all:"
133+
printf "%s" "$myenv"
134+
printf "%s" "$st"
135+
136+
printf "%s" "$osc"
132137
printf "1337;it2ssh=$TOKEN ${UNIQUEID} $ENCODED_BA $SSHARGS"
133-
print_st
138+
printf "%s" "$st"
139+
140+
printf "%s" "$osc"
141+
printf "1337;SendConductor=v=2"
142+
printf "%s" "$st"
143+
)
134144

135145
if [[ $TERM == screen* ]]; then
136146
st='\a\033\\'
137147
else
138148
st='\a'
139149
fi
140-
send_conductor='printf "\033]1337;SendConductor=v=2'"$st"'"'
150+
send_conductor='printf "%s '"$intro"'"'
141151

142152
# Run a command on the remote host that instructs iTerm2 to send a script, then reads the script and executes it.
143153
# I tried many ways to concatenate s and l and this is the only one that works on both Ubuntu 18 and Ubuntu 20.

0 commit comments

Comments
 (0)