The output of the invoked commands may be concatenated to the output of the EOI writing command. In some situations, the chunk passed in the _write() function contains not only the EOI string but also the output of the previously executed command. This issue will make the invoke function is stuck and never be resolved. Instead of comparing the chunk with the EOI string, I suggest checking if the chunk containing the EOI string.
The output of the invoked commands may be concatenated to the output of the EOI writing command. In some situations, the chunk passed in the _write() function contains not only the EOI string but also the output of the previously executed command. This issue will make the invoke function is stuck and never be resolved. Instead of comparing the chunk with the EOI string, I suggest checking if the chunk containing the EOI string.