when executed with emacs --batch -Q -l async-connect.el -f ert-run-tests-batch-and-exit It seems that accept-process-output correctly updates the process-status but it forgets to break out of the loop. With the following change, the test passes: