# ProcessMonitor
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-6)</span>

Fork+execs / creates a child process and monitors it. Notifies a client about
STDOUT / STDERR events.


```pony
actor tag ProcessMonitor is
  AsioEventNotify tag
```

#### Implements

* [AsioEventNotify](builtin-AsioEventNotify.md) tag

---

## Constructors

### create
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-35)</span>


Create infrastructure to communicate with a forked child process and
register the asio events. Fork child process and notify our user about
incoming data via the notifier.


```pony
new tag create(
  auth: StartProcessAuth val,
  backpressure_auth: ApplyReleaseBackpressureAuth val,
  notifier: ProcessNotify iso,
  filepath: FilePath val,
  args: Array[String val] val,
  vars: Array[String val] val,
  wdir: (FilePath val | None val) = reference,
  process_poll_interval: U64 val = call)
: ProcessMonitor tag^
```
#### Parameters

*   auth: [StartProcessAuth](process-StartProcessAuth.md) val
*   backpressure_auth: [ApplyReleaseBackpressureAuth](backpressure-ApplyReleaseBackpressureAuth.md) val
*   notifier: [ProcessNotify](process-ProcessNotify.md) iso
*   filepath: [FilePath](files-FilePath.md) val
*   args: [Array](builtin-Array.md)\[[String](builtin-String.md) val\] val
*   vars: [Array](builtin-Array.md)\[[String](builtin-String.md) val\] val
*   wdir: ([FilePath](files-FilePath.md) val | [None](builtin-None.md) val) = reference
*   process_poll_interval: [U64](builtin-U64.md) val = call

#### Returns

* [ProcessMonitor](process-ProcessMonitor.md) tag^

---

## Public Behaviours

### print
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-150)</span>


Print some bytes and append a newline.


```pony
be print(
  data: (String val | Array[U8 val] val))
```
#### Parameters

*   data: ([String](builtin-String.md) val | [Array](builtin-Array.md)\[[U8](builtin-U8.md) val\] val)

---

### write
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-159)</span>


Write to STDIN of the child process.


```pony
be write(
  data: (String val | Array[U8 val] val))
```
#### Parameters

*   data: ([String](builtin-String.md) val | [Array](builtin-Array.md)\[[U8](builtin-U8.md) val\] val)

---

### printv
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-167)</span>


Print an iterable collection of ByteSeqs.


```pony
be printv(
  data: ByteSeqIter val)
```
#### Parameters

*   data: [ByteSeqIter](builtin-ByteSeqIter.md) val

---

### writev
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-176)</span>


Write an iterable collection of ByteSeqs.


```pony
be writev(
  data: ByteSeqIter val)
```
#### Parameters

*   data: [ByteSeqIter](builtin-ByteSeqIter.md) val

---

### done_writing
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-184)</span>


Set the _done_writing flag to true. If _pending is empty we can close the
_stdin pipe.


```pony
be done_writing()
```

---

### dispose
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-195)</span>


Terminate child and close down everything.


```pony
be dispose()
```

---

### timer_notify
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-252)</span>


Windows IO polling timer has fired


```pony
be timer_notify()
```

---

## Public Functions

### expect
<span class="source-link">[[Source]](src/process/process_monitor.md#L-0-212)</span>


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


```pony
fun ref expect(
  qty: USize val = 0)
: None val
```
#### Parameters

*   qty: [USize](builtin-USize.md) val = 0

#### Returns

* [None](builtin-None.md) val

---

