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 {
108
108
appConnection.runMain ();
109
109
110
110
// Handle connection termination - send events first, then cleanup
111
- unawaited (debugConnection.onDone.then ((_ ) {
111
+ unawaited (debugConnection.onDone.whenComplete (( ) {
112
112
sendEvent ('app.log' , {
113
113
'appId' : appId,
114
114
'log' : 'Lost connection to device.' ,
@@ -226,21 +226,22 @@ class AppDomain extends Domain {
226
226
String appId, VmService vmService) async {
227
227
try {
228
228
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);
235
230
} catch (_) {}
236
231
237
232
// ignore: cancel_subscriptions
238
- return vmService.onStdoutEvent.listen ((log) {
233
+ final stdoutSubscription = vmService.onStdoutEvent.listen ((log) {
239
234
sendEvent ('app.log' , {
240
235
'appId' : appId,
241
236
'log' : utf8.decode (base64.decode (log.bytes! )),
242
237
});
243
238
});
239
+
240
+ try {
241
+ await vmService.streamListen (EventStreams .kStdout);
242
+ } catch (_) {}
243
+
244
+ return stdoutSubscription;
244
245
}
245
246
246
247
/// Cleans up an app connection and its associated listeners.
You can’t perform that action at this time.
0 commit comments