Uh oh!
There was an error while loading. Please reload this page.
Improve ShellStream Expect - #1315
Conversation
WojciechNagorski
commented
Feb 11, 2024
@Rob-Hague Can I ask for a review? |
Rob-Hague
left a comment
There was a problem hiding this comment.
Thanks
I have nearly fixed the remaining tests
WojciechNagorski
commented
Feb 11, 2024
@Rob-Hague Thanks! I haven't touched the other tests and I won't. |
| var result = text.Substring(0, match.Index + match.Length); | ||
| var charCount = _encoding.GetByteCount(result); | ||
| for (var i = 0; i < match.Index + match.Length && _incoming.Count > 0; i++) |
There was a problem hiding this comment.
Shouldn't this line use charCount?
Rob-Hague
commented
Feb 11, 2024
Btw, working on ShellStream makes me wish it derived from StreamReader rather than Stream... it would save a lot of repeated encoding work for the Expect methods (and just make more sense in general). But perhaps not worth the break. |
jscarle
commented
Feb 11, 2024
I believe that ShellStream still has it's place, however perhaps a new ShellStreamReader could be added that would consume the a ShellStream and we could slowly migrate functionality between the two classes. It could even be done in two steps. First by adding the new methods into ShellStreamReader, and then later deprecating them on ShellStream. |
WojciechNagorski
commented
Feb 22, 2024
This issue has been fixed in the 2024.0.0 version. |
There are three implementation of Expect method:
Two of them return string ends with the expected expression.
Only the first one works differently. In this PR I fixed this problem.
Moreover, the _incoming array contains bytes and regex works on UTF8 encoding, so we should count how many bytes we should remove from the incoming array.
Continuation of #1313
Added test failures for #1207 (does not fix performance issue)