Skip to content

Commit 3d38b16

Browse files
committed
fix: use java Stream methods available on JDK 11
1 parent 5040ab1 commit 3d38b16

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zio-process/jvm/src/main/scala/zio/process/ProcessPlatformSpecific.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import java.io.OutputStream
2020
import scala.jdk.CollectionConverters._
2121
import zio.ZIO
2222
import scala.annotation.nowarn
23+
import java.util.stream.Collectors
2324

2425
private[process] trait ProcessPlatformSpecific { self: Process =>
2526

@@ -50,7 +51,7 @@ private[process] trait ProcessPlatformSpecific { self: Process =>
5051
*/
5152
def killTree: ZIO[Any, CommandError, Unit] =
5253
self.execute { process =>
53-
val d = process.descendants().toList().asScala
54+
val d = process.descendants().collect(Collectors.toList()).asScala
5455
d.foreach { p =>
5556
destroyHandle(p)
5657
()
@@ -74,7 +75,7 @@ private[process] trait ProcessPlatformSpecific { self: Process =>
7475
*/
7576
def killTreeForcibly: ZIO[Any, CommandError, Unit] =
7677
self.execute { process =>
77-
val d = process.descendants().toList().asScala
78+
val d = process.descendants().collect(Collectors.toList()).asScala
7879
d.foreach { p =>
7980
destroyForciblyHandle(p)
8081
()

0 commit comments

Comments
 (0)