Skip to content

Commit

Permalink
Merge pull request #34 from vinted/fix/broken_pipe_exception
Browse files Browse the repository at this point in the history
Handle IO errors when running Packwerk
  • Loading branch information
oleg-vinted authored Sep 6, 2024
2 parents 99c341f + e185347 commit 0ea6d47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix Broken pipe error when running Packwerk (#34)

## [0.0.9] - 2024-06-14

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.vinted.packwerkintellij
pluginName = packwerk-intellij
pluginRepositoryUrl = https://github.com/vinted/packwerk-intellij
# SemVer format -> https://semver.org
pluginVersion = 0.0.9
pluginVersion = 0.0.10

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 233
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.intellij.markdown.lexer.push
import org.jetbrains.plugins.ruby.ruby.lang.psi.references.RColonReference
import org.jetbrains.plugins.ruby.ruby.lang.psi.references.RTopConstReference
import org.jetbrains.plugins.ruby.ruby.lang.psi.variables.RConstant
import java.io.IOException
import java.nio.charset.Charset
import java.util.*
import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -101,9 +102,14 @@ internal class PackwerkAnnotator : ExternalAnnotator<PackwerkAnnotator.State, Pa
}

if (useStdin) {
process.outputStream.write(collectedInfo.fileText!!.toByteArray())
process.outputStream.flush()
process.outputStream.close()
try {
process.outputStream.write(collectedInfo.fileText!!.toByteArray())
process.outputStream.flush()
process.outputStream.close()
} catch (e: IOException) {
thisLogger().warn("Failed to write to Packwerk process", e)
return null
}
}

if (!process.waitFor(runTimeout, runTimeoutUnit)) {
Expand Down

0 comments on commit 0ea6d47

Please sign in to comment.