From 84ad03b6fd5cd30ed2e80e2bcd4f39a31a9dc380 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Tue, 4 Jun 2024 11:03:35 -0400 Subject: [PATCH] Handle printer exception --- .../parsers/git_clone_update_printer.dart | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/src/utils/parsers/git_clone_update_printer.dart b/lib/src/utils/parsers/git_clone_update_printer.dart index 9cbf2fed..aa0b87a3 100644 --- a/lib/src/utils/parsers/git_clone_update_printer.dart +++ b/lib/src/utils/parsers/git_clone_update_printer.dart @@ -76,16 +76,21 @@ Future runGitCloneUpdate(List args) async { final processLogs = []; - // ignore: avoid-unassigned-stream-subscriptions - process.stderr.transform(utf8.decoder).listen((line) { - updateProgress(line); - processLogs.add(line); - }); - - // ignore: avoid-unassigned-stream-subscriptions - process.stdout.transform(utf8.decoder).listen((line) { - logger.info(line); - }); + try { + // ignore: avoid-unassigned-stream-subscriptions + process.stderr.transform(utf8.decoder).listen((line) { + updateProgress(line); + processLogs.add(line); + }); + + // ignore: avoid-unassigned-stream-subscriptions + process.stdout.transform(utf8.decoder).listen((line) { + logger.info(line); + }); + } catch (e) { + logger.detail('Formatting error due to invalid return $e'); + logger.info('Updating....'); + } final exitCode = await process.exitCode; if (exitCode != 0) {