#6 Expect.pm goes into infinate hang when interrupted

serious
closed
nobody
Core (10)
5
2006-05-31
2003-03-04
Chris P. Ross
No

If you have a signal handler set up, and it gets
called while Expect::expect() is inside of select(),
select() will return -1. But, you don't ever catch
this. You go on reading as if you got a positive number.

You should loop around your call to select, possibly
modifying the $time_left, to continue select()ing after
an interrupt has been processed. Ideally, you should
probably look at errno if select() returns -1, and do
different things based on if it's really EINTR, or some
other error condition.

I whacked up a minor patch to 1.07, but it's old, and
simplistic, so I won't include it. I presume it is a
simple enough problem that you can devise your own
solution.

Thank you.

Discussion

  • Logged In: NO

    This seems to happen in some cases when using Expect.pm
    inside httpd/Apache. The process receives a SIGCHLD and
    expect() hangs.

     
  • Roland Giersig
    Roland Giersig
    2006-05-31

    Logged In: YES
    user_id=40438

    this should be fixed in the latest version

     
  • Roland Giersig
    Roland Giersig
    2006-05-31

    • status: open --> closed