Skip to content

Commit 2233472

Browse files
committed
simplify mode
1 parent 49f2951 commit 2233472

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ val deployPlugin by tasks.registering {
7777
description = "Deploy plugin to running IDEs"
7878
dependsOn(tasks.buildPlugin)
7979
doLast {
80+
logging.captureStandardOutput(LogLevel.WARN)
81+
8082
val zip = tasks.buildPlugin.get().outputs.files.singleFile
8183
val home = File(System.getProperty("user.home"))
8284
val endpoints = home.listFiles { f -> f.name.matches(Regex("\\.\\d+\\.hot-reload")) }
@@ -92,14 +94,17 @@ val deployPlugin by tasks.registering {
9294
endpoints.forEach { (url, token) ->
9395
println("\n$url")
9496
val conn = (URI(url).toURL().openConnection() as HttpURLConnection).apply {
95-
requestMethod = "POST"; doOutput = true
97+
requestMethod = "POST"; doOutput = true; doInput = true
9698
setRequestProperty("Authorization", token)
9799
setRequestProperty("Content-Type", "application/octet-stream")
98100
connectTimeout = 5000; readTimeout = 300000
99101
}
100102
conn.outputStream.use { out -> zip.inputStream().use { it.copyTo(out) } }
101103
if (conn.responseCode in 200..299) {
102-
conn.inputStream.bufferedReader().forEachLine { println(" $it") }
104+
conn.inputStream.buffered().readAllBytes()
105+
.toString(Charsets.UTF_8)
106+
.lines()
107+
.forEach { println(" $it") }
103108
} else {
104109
println(" ✗ HTTP ${conn.responseCode}")
105110
}

src/main/kotlin/com/jonnyzzz/intellij/hotreload/HotReloadHttpHandler.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ class HotReloadHttpHandler : HttpRequestHandler() {
8282

8383
fun writeLine(line: String) {
8484
log.info("Hot reload progress: $line")
85-
if (!channel.isActive) return
86-
channel.eventLoop().execute {
87-
channel.writeAndFlush(DefaultHttpContent(Unpooled.copiedBuffer("$line\n", Charsets.UTF_8)))
88-
}
85+
channel.writeAndFlush(DefaultHttpContent(Unpooled.copiedBuffer("$line\n", Charsets.UTF_8)))
8986
}
9087

9188
val progressReporter = object : PluginHotReloadService.ProgressReporter {

0 commit comments

Comments
 (0)