Skip to content

Commit

Permalink
fix: incorrect handling of InterruptedExceptions if Gradle before 5.0…
Browse files Browse the repository at this point in the history
… fixed

Fixes #220
  • Loading branch information
augi committed Feb 14, 2020
1 parent 2a6418d commit 305cbd2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.avast.gradle.dockercompose

import org.gradle.api.Project
import org.gradle.api.logging.Logger
import org.gradle.internal.UncheckedException
import org.gradle.process.ExecSpec
import org.gradle.util.VersionNumber
import org.yaml.snakeyaml.Yaml
Expand Down Expand Up @@ -111,6 +112,13 @@ class ComposeExecutor {
executeWithCustomOutput(os, true, true, true, 'logs', '-f', '--no-color', *services)
} catch (InterruptedException e) {
logger.trace("Thread capturing container output has been interrupted, this is not an error", e)
} catch (UncheckedException ue) {
if (ue.cause instanceof InterruptedException) {
// Gradle < 5.0 incorrectly wrapped InterruptedException to UncheckedException
logger.trace("Thread capturing container output has been interrupted, this is not an error", ue)
} else {
throw ue
}
} finally {
os.close()
}
Expand Down

0 comments on commit 305cbd2

Please sign in to comment.