From 2eea7bfe5d8e3a0a237b960b561391163d42561c Mon Sep 17 00:00:00 2001 From: r1sim Date: Sun, 9 Feb 2020 21:48:03 +0100 Subject: [PATCH] fix retry mechanism in cmd method --- lib/src/utils.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 7fc44f0a..786819de 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -425,12 +425,13 @@ String cmd(List cmd, final result = processManager.runSync(cmd, workingDirectory: workingDirectory, runInShell: true); if(trace) _traceCommand(cmd, workingDirectory: workingDirectory); if (result.exitCode != 0) { - error = StdoutException(result.stdout, OSError(result.stderr, result.exitCode)); - throw error; + throw StdoutException(result.stdout, OSError(result.stderr, result.exitCode)); } // return stdout return result.stdout; } on StdoutException catch (e) { + error = e; + if(!retry) rethrow; sleep(Duration(seconds: 5)); } }