File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class AppDomain extends Domain {
108108 appConnection.runMain ();
109109
110110 // Handle connection termination - send events first, then cleanup
111- unawaited (debugConnection.onDone.then ((_ ) {
111+ unawaited (debugConnection.onDone.whenComplete (( ) {
112112 sendEvent ('app.log' , {
113113 'appId' : appId,
114114 'log' : 'Lost connection to device.' ,
@@ -226,21 +226,22 @@ class AppDomain extends Domain {
226226 String appId, VmService vmService) async {
227227 try {
228228 vmService.onServiceEvent.listen (_onServiceEvent);
229- await vmService.streamListen ('Service' );
230- } catch (_) {}
231-
232- // Set up stdout listener
233- try {
234- await vmService.streamListen ('Stdout' );
229+ await vmService.streamListen (EventStreams .kService);
235230 } catch (_) {}
236231
237232 // ignore: cancel_subscriptions
238- return vmService.onStdoutEvent.listen ((log) {
233+ final stdoutSubscription = vmService.onStdoutEvent.listen ((log) {
239234 sendEvent ('app.log' , {
240235 'appId' : appId,
241236 'log' : utf8.decode (base64.decode (log.bytes! )),
242237 });
243238 });
239+
240+ try {
241+ await vmService.streamListen (EventStreams .kStdout);
242+ } catch (_) {}
243+
244+ return stdoutSubscription;
244245 }
245246
246247 /// Cleans up an app connection and its associated listeners.
You can’t perform that action at this time.
0 commit comments