Skip to content

Commit

Permalink
fix: keep empty end line (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
denbezrukov authored Jan 10, 2025
1 parent ddd0222 commit a01fb1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class BiomePackage(private val project: Project) {
val processHandler =
BiomeTargetRunBuilder(project).getBuilder(binaryPath).addParameters(listOf("--version")).build()
return runCatching {
val result = processHandler.runProcessFuture().await()
val result = runProcessFuture(processHandler).await()
val processOutput = result.processOutput
val stdout = processOutput.stdout.trim()
val stdout = processOutput.stdout
val matchResult = versionRegex.find(stdout)
return matchResult?.value
}.getOrNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class BiomeStdinRunner(project: Project) : BiomeRunner {
setInputFile(file)
}.build()

val result = processHandler.runProcessFuture().await()
val result = runProcessFuture(processHandler).await()

val processOutput = result.processOutput
val stdout = processOutput.stdout.trim()
val stdout = processOutput.stdout
val stderr = processOutput.stderr.trim()

if (result.processEvent.isSuccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ class ProcessResult(val processEvent: ProcessEvent, val processOutput: ProcessOu

val ProcessEvent.isSuccess: Boolean get() = exitCode == 0

fun OSProcessHandler.runProcessFuture(): CompletableFuture<ProcessResult> {
fun runProcessFuture(handler: OSProcessHandler): CompletableFuture<ProcessResult> {
val future = CompletableFuture<ProcessResult>()

this.addProcessListener(object : CapturingProcessAdapter() {
handler.addProcessListener(object : CapturingProcessAdapter() {
override fun processTerminated(event: ProcessEvent) {
future.complete(ProcessResult(event, output))
}
})

this.startNotify()
handler.startNotify()

return future
}

0 comments on commit a01fb1e

Please sign in to comment.