[vm] Heap snapshot tool can load file from arguments
This CL allows the heap snapshot tool to load a file as it is launched via a command like ``` ../../../out/ReleaseX64/dart bin/explore.dart my_snapshot.heapsnapshot ``` Change-Id: I4eca4ec18daef4d3361c754018d234045e725ef5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275860 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
committed by
Commit Queue
parent
e4cc3c98e5
commit
dde72f78a2
@@ -50,7 +50,7 @@ class CompletionKeyHandler extends KeyHandler {
|
||||
}
|
||||
}
|
||||
|
||||
void main() async {
|
||||
Future<void> main(List<String> args) async {
|
||||
final console = SmartConsole();
|
||||
|
||||
console.write('The ');
|
||||
@@ -67,6 +67,24 @@ void main() async {
|
||||
|
||||
console.completionHandler = CompletionKeyHandler(cliState);
|
||||
|
||||
if (args.isNotEmpty) {
|
||||
if (args.length == 1 && args.single.trim().isNotEmpty) {
|
||||
console.setForegroundColor(ConsoleColor.brightYellow);
|
||||
console.writeLine('Will try to load ${args.single.trim()}.');
|
||||
console.resetColorAttributes();
|
||||
console.writeLine('');
|
||||
if (await cliCommandRunner.run(cliState, ['load', args.single.trim()])) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.setForegroundColor(ConsoleColor.brightRed);
|
||||
console.writeLine('When giving arguments, only one argument - '
|
||||
'the snapshot to load - is supported. Ignoring arguments.');
|
||||
console.resetColorAttributes();
|
||||
console.writeLine('');
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
final response = console.smartReadLine();
|
||||
console.resetColorAttributes();
|
||||
|
||||
Reference in New Issue
Block a user