Skip to content

Commit

Permalink
Move sharedStdIn.terminate to only run from top level (#6629)
Browse files Browse the repository at this point in the history
* Move sharedStdIn.terminate to only run from top level

Fixes #6624

* Remove now-unnecessary override

* Remove unused imports
  • Loading branch information
DanTup committed Nov 1, 2023
1 parent 49e6ff9 commit 9cfe8ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
5 changes: 4 additions & 1 deletion tool/bin/devtools_tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import 'dart:io';

import 'package:args/command_runner.dart';
import 'package:devtools_tool/devtools_command_runner.dart';
import 'package:io/io.dart';

void main(List<String> args) async {
final runner = DevToolsCommandRunner();
try {
final dynamic result = await runner.run(args);
final dynamic result =
await runner.run(args).whenComplete(sharedStdIn.terminate);

exit(result is int ? result : 0);
} catch (e) {
if (e is UsageException) {
Expand Down
12 changes: 0 additions & 12 deletions tool/lib/devtools_command_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:devtools_tool/commands/fix_goldens.dart';
import 'package:devtools_tool/commands/generate_code.dart';
import 'package:devtools_tool/commands/sync.dart';
import 'package:devtools_tool/commands/update_flutter_sdk.dart';
import 'package:io/io.dart';

import 'commands/analyze.dart';
import 'commands/list.dart';
Expand All @@ -35,14 +33,4 @@ class DevToolsCommandRunner extends CommandRunner {
addCommand(UpdateDevToolsVersionCommand());
addCommand(UpdateFlutterSdkCommand());
}

@override
Future runCommand(ArgResults topLevelResults) async {
try {
return await super.runCommand(topLevelResults);
} finally {
// Closes stdin for the entire program.
await sharedStdIn.terminate();
}
}
}

0 comments on commit 9cfe8ea

Please sign in to comment.