ProcessMonitor¶
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.
Implements¶
- AsioEventNotify tag
Public Behaviours¶
print¶
Print some bytes and append a newline.
Parameters¶
- data: ByteSeq
write¶
Write to STDIN of the child process.
Parameters¶
- data: ByteSeq
printv¶
Print an iterable collection of ByteSeqs.
Parameters¶
- data: ByteSeqIter val
writev¶
Write an iterable collection of ByteSeqs.
Parameters¶
- data: ByteSeqIter val
done_writing¶
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.
dispose¶
Terminate the child and stop monitoring. The exit status of the killed
child is reported through ProcessNotify.dispose once its exit event
fires.
Public Functions¶
expect¶
A stdout call on the notifier must contain exactly qty bytes. If
qty is zero, the call can contain any amount of data.
Parameters¶
- qty: USize val = 0
Returns¶
- None val