shouldExit method Null safety

Future shouldExit(
  1. [dynamic 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.


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