• Well, the root is here:

    void jshPushIOCharEvent(IOEventFlags channel, char charData) {
      if (charData==3 && channel==jsiGetConsoleDevice()) {
        // Ctrl-C - force interrupt
        execInfo.execute |= EXEC_CTRL_C;
        return;
      }
      //...
    }
    

    If the board wasn't idle and didn't consume IO buffer, \x03 will be just extracted out of context. And next time idle routine will try to handle IO buffer the first thing it will see is EXEC_CTRL_C flag. No matter that there were characters before the flag was set. These chars will be processed later.

    First possible solution is to add some magic to jshPushIOCharEvent so that \x03 will clear buffer. Not sure it's a good idea.

    A quick fix that works is to send some trash chars, wait, and then send the expression that starts with \x03. I've made a pull request with this fix.

About

Avatar for nailxx @nailxx started