improve expect so this works under at
authorIan Kelling <iank@fsf.org>
Wed, 25 Nov 2020 19:16:45 +0000 (14:16 -0500)
committerIan Kelling <iank@fsf.org>
Wed, 25 Nov 2020 19:16:45 +0000 (14:16 -0500)
pdt.sh

diff --git a/pdt.sh b/pdt.sh
index 21cb00f..237a4ad 100644 (file)
--- a/pdt.sh
+++ b/pdt.sh
@@ -23,15 +23,19 @@ rbow() {
     f=$(mktemp)
     cat >$f <<'EOF'
 # adds a short delay after each send for more reliable operation
-set force_conservative 0
+set force_conservative 1
 spawn "rainbowstream"
 # wait for prompt
 expect -nocase timeout {exit 1} "@*]: "
 set cmd [lindex $argv 0];
-send "$cmd\r\rq\r"
+send "$cmd\r\r"
+expect -nocase timeout {exit 1} "@*]: "
+# this may not be needed. didnt test
+sleep 2
+send "q\r"
 interact
 EOF
-    expect $f "$*" || { deactivate; rm -f $f; return 1; }
+    expect $f "$*" || { echo error: expect failed; deactivate; rm -f $f; return 1; }
     rm -f $f
   else
     rainbowstream