This project is read-only.

Problem with ShellStream.Expect(Regex regex, TimeSpan timeout)

Jun 18, 2013 at 9:34 AM
Edited Jun 18, 2013 at 9:38 AM

I have a problem with this method and I don't know if it's a bug or something implicit that I didn't do right.

When my ShellStream buffer is not big enough to hold all the response that comes after a command (ie I issue an "ls" command in a directory containing many many files), ShellStream.Expect(Regex regex, TimeSpan timeout) will wait for an infinite time. It never reaches the break or return statements.

Could it be the deadlock mentionned in the source ShellStream.cs comments ? (l. 512 : // TODO: Refactor this method, will deda lock)
Jun 19, 2013 at 11:16 AM
Edited Jun 19, 2013 at 11:26 AM
I was wrong on one detail : the problem doesn't occur because the buffer is full, but when the Regex has to be checked against a large amount of text (which takes a long time, dozens of seconds).
If I change the Regex to be very simple and fast, the timeout works as expected.
I have tried to increase the timeout (ie timeout set to 9000 seconds, higher than the Regex match time) but the timeout doesn't work either in that case.
Jul 3, 2013 at 12:07 PM
Please tell me if you need any more info about that problem