[ CLI ] dartdev null-safety migration cleanup

Follow-up to https://dart-review.googlesource.com/c/sdk/+/229948

Change-Id: If5624638eeb629ea025ec04b6a11d23144ea43ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231741
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
Ben Konyi 2022-02-04 19:23:40 +00:00 committed by Commit Bot
parent 14bead484c
commit 250173e60c
2 changed files with 9 additions and 7 deletions

View file

@ -97,15 +97,16 @@ class AnalysisServer {
];
_process = await startDartProcess(sdk, command);
final proc = _process!;
// This callback hookup can't throw.
_process!.exitCode.whenComplete(() => _process = null);
proc.exitCode.whenComplete(() => _process = null);
final Stream<String> errorStream = _process!.stderr
final Stream<String> errorStream = proc.stderr
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter());
errorStream.listen(log.stderr);
final Stream<String> inStream = _process!.stdout
final Stream<String> inStream = proc.stdout
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter());
inStream.listen(_handleServerResponse);

View file

@ -130,11 +130,12 @@ dev_dependencies:
],
workingDirectory: workingDir ?? dir.path,
environment: {if (logAnalytics) '_DARTDEV_LOG_ANALYTICS': 'true'});
final stdoutContents = _process!.stdout.transform(utf8.decoder).join();
final stderrContents = _process!.stderr.transform(utf8.decoder).join();
final code = await _process!.exitCode;
final proc = _process!;
final stdoutContents = proc.stdout.transform(utf8.decoder).join();
final stderrContents = proc.stderr.transform(utf8.decoder).join();
final code = await proc.exitCode;
return ProcessResult(
_process!.pid,
proc.pid,
code,
await stdoutContents,
await stderrContents,