File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -244,18 +244,21 @@ conductor_cmd_runpython() {
244
244
really_run_python () {
245
245
log really_run_python
246
246
unset RCOUNT
247
+ ttypath=$( tty)
248
+ log " tty is $ttypath "
247
249
exec python3 << ENDOFSCRIPT
248
250
import os
249
251
import sys
250
- tty_path = os.ttyname(sys.stdout.fileno())
252
+ tty_path = " $ttypath "
251
253
sys.stdin = open(tty_path, "r")
252
254
try:
253
- print(f"\033]135;:{os.getpid()}\033\\ \033]135;:end $boundary r 0\033\\\\ ", end="", flush=True)
255
+ print(f"\\ 033]135;:{os.getpid()}\\ 033\\\\ ", end="", flush=True)
256
+ print(f"\\ 033]135;:end $boundary r 0\\ 033\\\\ ", end="", flush=True)
254
257
program=""
255
258
for line in sys.stdin:
256
259
if line.rstrip() == "EOF":
257
260
exec(program)
258
- print(f"\033]135;:unhook\033\\\\ ", end="", flush=True)
261
+ print(f"\\ 033]135;:unhook\ \ 033\\\\ ", end="", flush=True)
259
262
break
260
263
program += line
261
264
except Exception as e:
Original file line number Diff line number Diff line change 147
147
send_conductor=' printf "\033]1337;SendConductor' " $st " ' "'
148
148
149
149
# Run a command on the remote host that instructs iTerm2 to send a script, then reads the script and executes it.
150
- sanitized=" $send_conductor " ' ;s="";IFS=""; stty -echo; while read -r l;do [ "$l" = EOF ]&&break; s="$s$l\n"; done; unset IFS; eval "$s"'
150
+ # I tried many ways to concatenate s and l and this is the only one that works on both Ubuntu 18 and Ubuntu 20.
151
+ sanitized=" $send_conductor " ' ;s="";IFS=""; stty -echo; while read -r l;do [ "$l" = EOF ]&&break; s=$(printf "%s\n%s" "$s" "$l"); done; unset IFS; eval "$s"'
151
152
152
153
# If ssh gets a signal, let it2ssh keep running.
153
154
set +e
You can’t perform that action at this time.
0 commit comments