expectExitCode method
Implementation
Future expectExitCode(Iterable<int> acceptedCodes) async {
var code = await exitCode;
if (!acceptedCodes.contains(code))
throw new StateError(
'$invocation terminated with unexpected exit code $code.');
else
await stderr.drain();
}