Exit callback type for testing. Replaces flushThenExit.
flushThenExit
typedef ExitCallback = Future<void> Function(TermLib term, int exitCode);