exitCode property

Future<int> exitCode

The exit code indicating the status of the script's execution.

An exit code of 0 indicates success or a "true" return value, and any non-zero exit code indicates failure or a "false" return value. Otherwise, different scripts use different conventions for non-zero exit codes.

Throws any Dart exceptions that come up when running this Script.

See also success, which should be preferred when simply checking whether the script has succeeded.

Implementation

Future<int> get exitCode => done.then((_) => 0, onError: (Object error, _) {
      if (error is! ScriptException) throw error;
      return error.exitCode;
    });