From dc9ce095b402b8a1d142cb2cb37f096108e3a510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Thu, 29 Feb 2024 10:00:03 +0000 Subject: [PATCH] chore: version bin folder --- .../wyatt_continuous_deployment/.gitignore | 1 + .../bin/wyatt_continuous_deployment.dart | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 packages/wyatt_continuous_deployment/bin/wyatt_continuous_deployment.dart diff --git a/packages/wyatt_continuous_deployment/.gitignore b/packages/wyatt_continuous_deployment/.gitignore index 3cceda55..78b10b11 100644 --- a/packages/wyatt_continuous_deployment/.gitignore +++ b/packages/wyatt_continuous_deployment/.gitignore @@ -5,3 +5,4 @@ # Avoid committing pubspec.lock for library packages; see # https://dart.dev/guides/libraries/private-files#pubspeclock. pubspec.lock +!bin/ \ No newline at end of file diff --git a/packages/wyatt_continuous_deployment/bin/wyatt_continuous_deployment.dart b/packages/wyatt_continuous_deployment/bin/wyatt_continuous_deployment.dart new file mode 100644 index 00000000..0f5f8c40 --- /dev/null +++ b/packages/wyatt_continuous_deployment/bin/wyatt_continuous_deployment.dart @@ -0,0 +1,20 @@ +import 'dart:io'; + +import 'package:mason_logger/mason_logger.dart'; +import 'package:wyatt_continuous_deployment/src/bootstrap.dart'; +import 'package:wyatt_continuous_deployment/src/wyatt_continuous_deployment_command_runner.dart'; + +Future main(List args) async { + await bootstrap(Logger()); + await flushThenExit(await WyattContinuousDeploymentCommandRunner().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) => + Future.wait([stdout.close(), stderr.close()]) + .then((_) => exit(status));