DiamondLightSource / tickit

Event-based hardware simulation framework
Apache License 2.0
7 stars 0 forks source link

Fix SplittingInterpreter for trailing delimiters #114

Closed MJGaughran closed 1 year ago

MJGaughran commented 1 year ago

If the delimiter used by SplittingInterpreter is at the end of a message, it will return an empty string. I believe it should also discard empty strings from re.split().

It appears that 74e0227 introduced this bug in the original pull request.

The intention behind my work was to split on e.g. \r\n if two messages were received alongside each other. If you use the SplittingInterpreter as above, it will fail on individual commands.

A temporary workaround is to create a RegexCommand to discard the empty messages.

MJGaughran commented 1 year ago

I am not aware of a preferred method for splitting messages like the above. Regardless, I cannot think of a situation in which you would want empty strings returned.

joeshannon commented 1 year ago

Fixed by #133