diff --git a/tools/bots/get_builder_status.dart b/tools/bots/get_builder_status.dart index 82aca7c2b05d..e464abcf22c4 100755 --- a/tools/bots/get_builder_status.dart +++ b/tools/bots/get_builder_status.dart @@ -53,6 +53,11 @@ ${parser.usage}'''); exit(1); } +Future readGcloudAuthToken(String path) async { + String token = await File(path).readAsString(); + return token.split("\n").first; +} + main(List args) async { final parser = new ArgParser(); parser.addFlag('help', help: 'Show the program usage.', negatable: false); @@ -72,7 +77,11 @@ main(List args) async { builder = options['builder']; buildNumber = int.parse(options['build_number']); builderBase = builder.replaceFirst(RegExp('-try\$'), ''); - token = await File(options['auth_token']).readAsString(); + if (options['auth_token'] == null) { + print('Option "--auth_token (-a)" is required\n'); + usage(parser); + } + token = await readGcloudAuthToken(options['auth_token']); client = http.Client(); for (int count = 0; count < numAttempts; ++count) { if (count > 0) {