X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org From: "Damo, David" To: "cygwin AT cygwin DOT com" Date: Wed, 20 Jan 2010 15:04:12 -0500 Subject: Issues with terminal freezing after scp in expect script. Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, =20 I have interesting problem. I have bash script that calls an expect script = that works fine and does an scp. However after the scp the terminal freezes= . It is stuck on the bash prompt, however the prompt is not the original pr= ompt. After I do ctrl C it continues to process. I tried to do a ctrl c/bre= ak/exit in the expect script, but it does not work. Any ideas what could be= causing the problem? Scripts are below: =20 Bash script: =20 #!/usr/bin/bash =20 echo `date` " - Starting shell script." =20 touch /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/runshell =20 echo `date` " - Copy files." =20 expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWeblog= ic/SMWeblogiccp.exp $1 $2 $5 $6 =20 file=3D`basename $1` =20 echo `date` " - Run build on: " $file # expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWebl= ogic/SMWeblogicrun.exp $1 $2 $5 $6 $3 $4 =20 echo `date` " - Finished." =20 =20 Expect script: =20 #!/usr/local/bin/expect -f # set filename [lindex $argv 0] set hostname [lindex $argv 1] set uu [lindex $argv 2] set unixpass [lindex $argv 3] =20 set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively o= riginally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } =20 =20 set timeout -1 spawn $env(SHELL) match_max 100000 send -- "scp $filename $uu@$hostname:/tmp/\r" while {1} { expect { "Are you sure you want to continue connecting (yes/no)?" {exp_s= end "yes\r"} "*assword:" { send "$unixpass\r"; } } } exp_send -- "=20 ---------------------------------------------------------------------------= ----- " send -- "exit\r" sleep 10 # send -- "scp /apps/sjsws/sunws-acs/https-acsdemo.cibcwm.com/docs/archives= /smasa-12.zip $uu@$hostname:/tmp/\r" while {1} { expect { "Are you sure you want to continue connecting (yes/no)?" {exp_s= end "yes\r"} "*assword:" { send "$unixpass\r"; } } } sleep 30 send -- "exit\r" expect eof =20 Thanks, David J -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple