shouldExit method

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

Implementation

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