File tree Expand file tree Collapse file tree
src/jsMain/kotlin/net/kautler/github/action/setup_wsl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717package net.kautler.github.action.setup_wsl
1818
1919import actions.core.debug
20- import actions.core.info
2120import actions.core.isDebug
2221import actions.exec.ExecOptions
2322import actions.exec.exec
@@ -487,16 +486,3 @@ object Alpine : ApkBasedDistribution(
487486 productId = " 9p804crf0395" ,
488487 installerFile = " Alpine.exe"
489488)
490-
491- private suspend inline fun <T > retry (amount : Int , crossinline block : suspend () -> T ): T {
492- (1 .. amount).map { i ->
493- runCatching {
494- return block()
495- }.onFailure {
496- if (i != 5 ) {
497- debug(it.stackTraceToString())
498- info(" Failure happened, retrying (${it.message ? : it} )" )
499- }
500- }
501- }.last().getOrThrow<Nothing >()
502- }
Original file line number Diff line number Diff line change 1+ package net.kautler.github.action.setup_wsl
2+
3+ import actions.core.debug
4+ import actions.core.info
5+
6+ internal suspend inline fun <T > retry (amount : Int , crossinline block : suspend () -> T ): T {
7+ (1 .. amount).map { i ->
8+ runCatching {
9+ return block()
10+ }.onFailure {
11+ if (i != 5 ) {
12+ debug(it.stackTraceToString())
13+ info(" Failure happened, retrying (${it.message ? : it} )" )
14+ }
15+ }
16+ }.last().getOrThrow<Nothing >()
17+ }
Original file line number Diff line number Diff line change @@ -375,9 +375,11 @@ suspend fun installDistribution() {
375375 wslArguments = arrayOf(" --set-default-version" , " ${wslVersion()} " )
376376 )
377377 if (wslVersion() != 1u ) {
378- executeWslCommand(
379- wslArguments = arrayOf(" --update" )
380- )
378+ retry(5 ) {
379+ executeWslCommand(
380+ wslArguments = arrayOf(" --update" )
381+ )
382+ }
381383
382384 (2 .. 30 )
383385 .asFlow()
You can’t perform that action at this time.
0 commit comments