Skip to content

ProcessMonitor

[Source]

Monitors a running child process: forwards its STDOUT/STDERR to a ProcessNotify, writes to its STDIN, and reports its exit status once it exits. Create one with StartProcess.

Exit is detected from a native per-platform event (a pidfd on Linux), not from the child's pipes reaching end-of-file, so a child that leaves a grandchild holding its stdout/stderr open is still reported as exited promptly.

actor tag ProcessMonitor is
  AsioEventNotify tag

Implements


Public Behaviours

print

[Source]

Print some bytes and append a newline.

be print(
  data: ByteSeq)

Parameters


write

[Source]

Write to STDIN of the child process.

be write(
  data: ByteSeq)

Parameters


printv

[Source]

Print an iterable collection of ByteSeqs.

be printv(
  data: ByteSeqIter val)

Parameters


writev

[Source]

Write an iterable collection of ByteSeqs.

be writev(
  data: ByteSeqIter val)

Parameters


done_writing

[Source]

Signal that we are finished writing to STDIN. Once any pending writes have drained, STDIN is closed so a child waiting on EOF can proceed.

be done_writing()

dispose

[Source]

Terminate the child and stop monitoring. The exit status of the killed child is reported through ProcessNotify.dispose once its exit event fires.

be dispose()

Public Functions

expect

[Source]

A stdout call on the notifier must contain exactly qty bytes. If qty is zero, the call can contain any amount of data.

fun ref expect(
  qty: USize val = 0)
: None val

Parameters

Returns