1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-11 23:53:12 +00:00

Avoid Expect clobbering stdout when stdin isn't a tty.

Doing expect_after before a child process has been spawned causes Expect
to try reading from stdin. If stdin is /dev/null, it gets an EOF from
the read, assumes it's been closed... and closes stdout too, so we don't
see any more of the child process interaction.
This commit is contained in:
Adam Sampson 2018-08-04 01:25:35 +01:00 committed by Lars Brinkhoff
parent 0ac926bc7d
commit 8b8e1cf952
4 changed files with 13 additions and 1 deletions

View File

@ -115,7 +115,11 @@ proc build_macsyma_portion {} {
}
set timeout 100
expect_after timeout abort
proc setup_timeout {} {
# Don't do this until after you've called "spawn", otherwise it'll cause a
# read from stdin which will return EOF if stdin isn't a tty.
expect_after timeout abort
}
set ip [ip_address [lindex $argv 0]]
set gw [ip_address [lindex $argv 1]]

View File

@ -7,6 +7,7 @@ set emulator_escape "\034"
proc start_salv {} {
uplevel #0 {spawn ./kn10-ks-its nsalv.ini}
setup_timeout
expect "EOF"
respond "KLH10#" "go\r"
}
@ -20,12 +21,14 @@ proc start_dskdmp {} {
#respond "KLH10>" "zero\r"
quit_emulator
uplevel #0 {spawn ./kn10-ks-its dskdmp.ini}
setup_timeout
expect "EOF"
respond "KLH10#" "go\r"
}
proc start_its {} {
uplevel #0 {spawn ./kn10-ks-its dskdmp.ini}
setup_timeout
expect "EOF"
respond "KLH10#" "go\r"
}

View File

@ -4,6 +4,8 @@ set emulator_escape "\034"
proc start_salv {} {
uplevel #0 {spawn pdp10 build/simh/init}
setup_timeout
respond "sim>" "show ver\r"
respond "sim>" "b tu1\r"
expect "MTBOOT"
@ -23,6 +25,7 @@ proc start_dskdmp {} {
proc start_its {} {
uplevel #0 {spawn pdp10 build/simh/boot}
setup_timeout
}
proc mount_tape {file} {

View File

@ -4,6 +4,7 @@ set emulator_escape "\034"
proc start_salv {} {
uplevel #0 {spawn ./tools/sims/BIN/ka10 build/sims/init}
setup_timeout
expect "MAGDMP\r\n"; send "l\033ddt\r"
expect "\n"; send "t\033salv\r"
}
@ -19,6 +20,7 @@ proc start_dskdmp args {
}
set foo "spawn ./tools/sims/BIN/ka10 $ini"
uplevel #0 $foo
setup_timeout
}
proc mount_tape {file} {