Skip to content

Commit d423554

Browse files
committed
Use IOUtils in PosixPluginFrontendSpec
1 parent 0ba6fcf commit d423554

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

bridge/src/test/scala/protocbridge/frontend/OsSpecificFrontendSpec.scala

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package protocbridge.frontend
22

3+
import org.apache.commons.io.IOUtils
34
import org.scalatest.flatspec.AnyFlatSpec
45
import org.scalatest.matchers.must.Matchers
56
import protocbridge.{ExtraEnv, ProtocCodeGenerator}
@@ -30,17 +31,13 @@ class OsSpecificFrontendSpec extends AnyFlatSpec with Matchers {
3031
writeInput.close()
3132
},
3233
processOutput => {
33-
val buffer = new Array[Byte](4096)
34-
var bytesRead = 0
35-
while (bytesRead != -1) {
36-
bytesRead = processOutput.read(buffer)
37-
if (bytesRead != -1) {
38-
actualOutput.write(buffer, 0, bytesRead)
39-
}
40-
}
34+
IOUtils.copy(processOutput, actualOutput)
4135
processOutput.close()
4236
},
43-
_.close()
37+
processError => {
38+
IOUtils.copy(processError, System.err)
39+
processError.close()
40+
}
4441
)
4542
)
4643
process.exitValue()

0 commit comments

Comments
 (0)