Skip to content

Fix character encoding when piping stdout on Windows #5659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ trait RunnerOrchestration {
val sb = new StringBuilder

if (childStdout eq null)
childStdout = new BufferedReader(new InputStreamReader(process.getInputStream))
childStdout = new BufferedReader(new InputStreamReader(process.getInputStream, "UTF-8"))

var childOutput: String = childStdout.readLine()

Expand All @@ -127,8 +127,7 @@ trait RunnerOrchestration {
childOutput = childStdout.readLine()

while (childOutput != ChildJVMMain.MessageEnd && childOutput != null) {
sb.append(childOutput)
sb += '\n'
sb.append(childOutput).append(System.lineSeparator)
childOutput = childStdout.readLine()
}

Expand Down Expand Up @@ -161,7 +160,7 @@ trait RunnerOrchestration {
val url = classOf[ChildJVMMain].getProtectionDomain.getCodeSource.getLocation
val cp = Paths.get(url.toURI).toString + JFile.pathSeparator + Properties.scalaLibrary
val javaBin = sys.props("java.home") + sep + "bin" + sep + "java"
new ProcessBuilder(javaBin, "-Xmx1g", "-cp", cp, "dotty.tools.vulpix.ChildJVMMain")
new ProcessBuilder(javaBin, "-Dfile.encoding=UTF-8", "-Xmx1g", "-cp", cp, "dotty.tools.vulpix.ChildJVMMain")
.redirectErrorStream(true)
.redirectInput(ProcessBuilder.Redirect.PIPE)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
Expand Down