mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
[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:
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();
|
||||
|
|
Loading…
Reference in a new issue