scrapli
scrapli copied to clipboard
Finding a `interaction_complete_patterns` does not end interactive session
Describe the bug
According to the documentation of send_interactive
(specifically in sync_driver.py)
interaction_complete_patterns: list of patterns, that if seen, indicate the interactive
"session" has ended and we should exit the interactive session.
I take this to mean that no more input will be send if one of those patterns is seen. The actual behavior is slightly different. It handles these patterns like the prompt and continues to send input after seeing one.
This is also supported if you dig down into the code. Going GenericDriver.send_interactive -> Channel.send_inputs_interact
you can see that it is impossible to gracefully break out of the for interact_event in interact_events
loop (i.e. all interactive events will be sent).
https://github.com/carlmontanari/scrapli/blob/ac1446873929bd9f4732f07ab4993fbeefb47236/scrapli/channel/sync_channel.py#L644-L670