ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/demos/demo_helpers.tcl
Martin von Zweigbergk b1d473eafb demos: make run_command wait for the prompt
Most commands are non-interactive, so this reduces duplication. We can
add another function for running a command and not waiting for a
prompt when we need it.
2021-10-22 18:04:43 -07:00

26 lines
465 B
Tcl

set send_human {0.1 0.3 1 0.05 1}
set timeout 2
proc expect_prompt {} {
expect "$ "
}
proc run_command {cmd} {
send -h "$cmd"
send "\r"
expect -timeout 5 "$ "
}
proc quit_and_dump_asciicast_path {} {
set CTRLC \003
set CTRLD \004
set ESC \033
send $CTRLD
expect "asciinema: recording finished"
sleep 1
send $CTRLC
expect -re "asciicast saved to (.+)$ESC.*\r" {
send_user "$expect_out(1,string)\n"
}
}