import 'dart:io'; import 'package:yoyo_get_fast_mirror/src/command_runner.dart'; Future main(List args) async { await _flushThenExit(await YoyoGetFastMirrorCommandRunner().run(args)); } /// Flushes the stdout and stderr streams, then exits the program with the given /// status code. /// /// This returns a Future that will never complete, since the program will have /// exited already. This is useful to prevent Future chains from proceeding /// after you've decided to exit. Future _flushThenExit(int status) { return Future.wait([stdout.close(), stderr.close()]) .then((_) => exit(status)); }