Skip to content

Commit

Permalink
Add Appendable instance for Processs
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Nov 3, 2023
1 parent 7f98807 commit 2bb598e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/guillotine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ class OsProcess private (java: ProcessHandle) extends ProcessRef:
val duration = java.info.nn.totalCpuDuration.nn
if duration.isPresent then SpecificDuration(duration.get.nn.toMillis) else Unset

object Process:
given appendable
[ChunkType]
(using writable: Writable[ji.OutputStream, ChunkType])
: Appendable[Process[?, ?], ChunkType]^{writable} =
(process, stream) => process.stdin(stream)

class Process[+ExecType <: Label, ResultType](process: java.lang.Process) extends ProcessRef:
def pid: Pid = Pid(process.pid)
def alive: Boolean = process.isAlive
Expand Down

0 comments on commit 2bb598e

Please sign in to comment.