Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Dec 2005 09:17:56 -0600
From:      Martin McCormick <martin@dc.cis.okstate.edu>
To:        freebsd-questions@freebsd.org
Subject:   Expect-5.32.1 and Hangups when Spawning a Shell
Message-ID:  <200512141517.jBEFHuhn072778@dc.cis.okstate.edu>

next in thread | raw e-mail | index | archive | help
	Has anyone seen a condition in FreeBSD4.7 in which
expect-5.32.1 randomly hangs when spawning a shell?

	I got this idea from running autoexpect:

spawn $env(SHELL)

	Then, I would look for the prompt and begin executing
commands.

	About every 20 or 30 times, no shell spawns and the script
just hangs there with 1 virtual terminal seized until someone kills
the process.  Since the particular expect script is run automaticly,
one can run out of tty's in a few weeks if this happens often enough
or one doesn't clean house regularly.

	What I recently tried is to set conservative mode to 1 so it
will output data more slowly although I can't imagine how this really
helps.

	Strangely enough, it has been several days since I made the
change and I haven't had to zap one single expect script.

	Is that just coincidence or could the timing of the spawn
command actually matter?  Remember, this is before the shell ever
starts.

	Here is what the beginning of the script now looks like:

#!/usr/local/bin/expect -f

if {$force_conservative} {
	set send_slow {1 .1}
	proc send {ignore arg} {
		sleep .1
		exp_send -s -- $arg
	}
}

spawn $env(SHELL)
match_max 100000
expect -exact "bash-2.05b# "

	When it fails, the prompt never appears.

	Any ideas as to why this occasionally happens or whether my
slow-down of the "typed" output should help is much appreciated.

Martin McCormick WB5AGZ  Stillwater, OK 
OSU Information Technology Department Network Operations Group
.-- -... ..... .- --. --..



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512141517.jBEFHuhn072778>