0

I am trying to solve my question that I've asked here using expect script instead of file redirection. Unfortunately, this solution doesn't work as well (the same behaviour as described in the question above: I have to run the script below ./driver.exp multiple times to get the expected result.

Here is the error message:


...

 Input > QUIT
send: spawn id exp4 not open
    while executing
"send "VOPT\n""
    (file "./driver.exp" line 33)

(The full stdout output can be found here)

Here is my driver.exp file:

#!/usr/bin/expect

spawn construct2d

expect "Input"
send "naca0012.dat\n"

expect "Command"
send "SOPT\n"

expect "Input"
send "NSRF\n"

expect "New value"
send "80\n"

expect "Input"
send "RADI\n"

expect "New value"
send "1\n"

expect "Input"
send "NWKE\n"

expect "New value"
send "1\n"

expect "Input"
send "QUIT\n"

expect "Command"
send "VOPT\n"

expect "Input"
send "JMAX\n"

expect "New value"
send "1\n"

expect "Input"
send "YPLS\n"

expect "New value"
send "5\n"

expect "Input"
send "RECD\n"

expect "New value"
send "1E5\n"

expect "Input"
send "QUIT\n"

expect "Command"
send "GRID\n"

expect "Input"
send "SMTH\n"

expect "Command"
send "QUIT\n"

interact

Could you please, help me understand why is this happening?

I appreciate your help

5
  • Apparently when you send QUIT, the construct2d program quits. And then the next send fails because there's no running process to talk to. Commented Sep 16, 2020 at 21:11
  • Try using autoexpect to generate the expect code. Commented Sep 16, 2020 at 21:12
  • @glennjackman: Thank you for the feedback. Do you have an idea why it does quit? because in some case it just runs fine. Commented Sep 16, 2020 at 22:01
  • I have no way to even guess. I've never heard of constructed before. Commented Sep 16, 2020 at 23:06
  • *construct2d* Commented Sep 17, 2020 at 14:03

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.