Skip to content

Commit

Permalink
Merge pull request #196 from leoafarias/hotfix/195
Browse files Browse the repository at this point in the history
Fix: Exit after use command
  • Loading branch information
leoafarias authored Dec 18, 2020
2 parents cd9b653 + cd93958 commit 0aa96ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions packages/cli/bin/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'dart:io';

import 'package:fvm/fvm.dart';

Future<void> main(List<String> arguments) async {
await fvmRunner(arguments);
exit(exitCode);
}
3 changes: 0 additions & 3 deletions packages/cli/lib/src/commands/use_command.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:args/command_runner.dart';
import 'package:cli_dialog/cli_dialog.dart';

Expand Down Expand Up @@ -84,6 +82,5 @@ class UseCommand extends Command {
await useVersionWorkflow(validVersion, global: global, force: force);

await checkIfLatestVersion();
exit(0);
}
}
8 changes: 5 additions & 3 deletions packages/cli/lib/src/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,20 @@ Future<void> fvmRunner(List<String> args) async {
runner..addCommand(ConfigCommand());
runner..addCommand(ReleasesCommand());

return await runner.run(args).catchError((exc, st) {
try {
await runner.run(args);
} catch (exc, st) {
if (exc is String) {
FvmLogger.warning(exc);
} else {
FvmLogger.warning('${yellow.wrap(exc.toString())}');
if (args.contains('--verbose')) {
FvmLogger.error(st.toString());
throw exc;
rethrow;
}
}
exitCode = 1;
}).whenComplete(() {});
}
}

/// Builds FVM Runner
Expand Down

0 comments on commit 0aa96ee

Please sign in to comment.