shouldExit method

Future<void> shouldExit([
  1. Object? expectedExitCode
])

Waits for the process to exit, and verifies that the exit code matches expectedExitCode (if given).

If this is called after the process is already dead, it verifies its existing exit code.

Implementation

Future<void> shouldExit([Object? expectedExitCode]) async {
  var exitCode = await this.exitCode;
  if (expectedExitCode == null) return;
  expect(exitCode, expectedExitCode,
      reason: 'Process `$description` had an unexpected exit code.');
}