Skip to content

Commit e431262

Browse files
committed
Update utls to return proper exit code when fetch-configlet fails
1 parent af52bba commit e431262

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

bin/check_formatting.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Future main() async {
55
final CommonUtils utils = CommonUtils();
66
int errorCode = 0;
77

8-
if (utils.fetchConfiglet() == 0) {
8+
if (await utils.fetchConfiglet() == 0) {
99
print('Checking config.json formatting...');
1010
errorCode = await utils.runCmdIfExecutable('bin/configlet', ['lint', '--track-id', 'dart', '.']);
1111

bin/presubmit.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:exercism_dart/src/utils.dart';
44
Future<Null> main() async {
55
final CommonUtils utils = CommonUtils();
66

7-
if (utils.fetchConfiglet() == 0) {
7+
if (await utils.fetchConfiglet() == 0) {
88
print('Formatting config.json...');
99
await utils.runCmdIfExecutable('bin/configlet', ['fmt', '.']);
1010
}

lib/src/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ class CommonUtils {
1111

1212
/// Fetches the configlet file if it doesn't exist already, and returns the
1313
/// exit code.
14-
int fetchConfiglet() {
14+
Future<int> fetchConfiglet() async {
1515
final configletFile = File('bin/configlet');
1616

1717
if (!configletFile.existsSync()) {
1818
print('Fetching configlet...');
19-
return _exit(Process.runSync('bin/fetch-configlet', []).exitCode);
19+
return _exit(await runCmdIfExecutable('bin/fetch-configlet'));
2020
}
2121

2222
return 0;

0 commit comments

Comments
 (0)