Skip to content

Commit 3041aed

Browse files
committed
Use IOUtils in PosixPluginFrontendSpec
1 parent 40206b8 commit 3041aed

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

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

+2-8
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}
@@ -33,14 +34,7 @@ class PosixPluginFrontendSpec extends AnyFlatSpec with Matchers {
3334
writeInput.write(toSend)
3435
writeInput.close()
3536
}, processOutput => {
36-
val buffer = new Array[Byte](4096)
37-
var bytesRead = 0
38-
while (bytesRead != -1) {
39-
bytesRead = processOutput.read(buffer)
40-
if (bytesRead != -1) {
41-
actualOutput.write(buffer, 0, bytesRead)
42-
}
43-
}
37+
IOUtils.copy(processOutput, actualOutput)
4438
processOutput.close()
4539
}, _.close()))
4640
process.exitValue()

0 commit comments

Comments
 (0)