Sample Header Ad - 728x90

Expect exiting, not responding to text sent

1 vote
1 answer
781 views
I have an expect script that is exiting, instead of processing text that is sent and installing files. I'm trying to figure out why it's not installing files, i.e. not implementing what would be done had I run the process manually instead of via expect. I have the following code in my script: #!/usr/bin/expect set exp_internal 1 set timeout 30 set java [lindex $argv 0]; set installer [lindex $argv 1]; spawn $java -jar $installer -console expect { "*More*" { send " "; exp_continue } "Press 1 to accept, 2 to reject, 3 to redisplay" { send "1\r" } } expect "Select the installation path:*" { send "/opt/pentaho8.3\r" } expect "Press 1 to continue, 2 to quit, 3 to redisplay\r\n" { send "1\r" } close exit When I run the script as follows: $ sudo /usr/bin/expect -d install-pentaho.expect /usr/java/jdk1.8.0_261/bin/java pentaho-server-manual-ee-8.3.0.0-371/installer.jar It runs as expected, except for the last couple lines: send: sending "/opt/pentaho8.3\r" to { exp6 } expect: does "" (spawn_id exp6) match glob pattern "Press 1 to continue, 2 to quit, 3 to redisplay\r\n"? no /opt/pentaho8.3 expect: does "/opt/pentaho8.3\r\r\n" (spawn_id exp6) match glob pattern "Press 1 to continue, 2 to quit, 3 to redisplay\r\n"? no Press 1 to continue, 2 to quit, 3 to redisplay expect: does "/opt/pentaho8.3\r\r\n\r\nPress 1 to continue, 2 to quit, 3 to redisplay\r\n" (spawn_id exp6) match glob pattern "Press 1 to continue, 2 to quit, 3 to redisplay\r\n"? yes expect: set expect_out(0,string) "Press 1 to continue, 2 to quit, 3 to redisplay\r\n" expect: set expect_out(spawn_id) "exp6" expect: set expect_out(buffer) "/opt/pentaho8.3\r\r\n\r\nPress 1 to continue, 2 to quit, 3 to redisplay\r\n" send: sending "1\r" to { exp6 } Anyone have thoughts as to why the '1' being sent by expect is getting ignored? It seems that the spawned process is exiting, ignoring the '1' that is sent. Below is the expected output, i.e. what I get when I run sudo /usr/java/jdk1.8.0_261/bin/java -jar pentaho-server-manual-ee-8.3.0.0-371/installer.jar -console manually: Select the installation path: [/root/pentaho/pentaho-server-manual-ee-8.3.0.0-371] /opt/pentaho8.3 Press 1 to continue, 2 to quit, 3 to redisplay 1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Installation ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [ Starting to unpack ] [ Processing package: Base (1/1) ] [ Unpacking finished ] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Installation Finished ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Installation was successful Application installed on /opt/pentaho8.3 [ Console installation done ] Any thoughts on why the installation is not occurring, and the expect script is exiting prematurely?
Asked by Burvil (43 rep)
Sep 21, 2020, 09:55 PM
Last activity: Sep 22, 2020, 01:05 AM