A simple fix is to add a timeout value to the call to accept-process-output. For example, adding a 1 second timeout not only allows it to recover but also allows Control-g to be honoured. Because control-g now is not ignored, the value could be increased substantially, say to 10 [seconds].