From: Austin S. <te...@of...> - 2002-09-09 18:37:07
|
On Mon, Sep 09, 2002 at 12:17:41PM -0600, Walls Rob W Contr 75 CS/SCBS wrote: > I removed the explicitly added \n from the password ->send string. Now > debug reports Sending '1derful^J' to spawn id(3) instead of the > '1derful\n\012' it was sending. However, the intermittent hang still occurs. > When things hang, Expect receives the password instead of 'New password'. > That is: > Waiting for new data ... > 1derful > > instead of: > > Waiting for new data ... > New password: > It's like the answer arrives before the question is asked... Typically a well written password program, i.e. one that asks for a password, should turn echoing off before printing the 'Password: ' prompt. Some programs, such as /bin/passwd included w/ redhat 6.2, send the password prompt, and then flush the pty buffer as they set '-echo' on the line. This creates a race condition that may be experienced maybe 2-5% of the time. I would first turn on $Exp_Internal and make sure you are expecting a space after 'New password:', if one is sent. Once that is correct and you are 100% sure you're matching the correct prompt, sleep(1) before sending the password. That way you will give the program a chance to set echoing off and get ready to receive the data well before you send it. Austin |