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

Fork+exec (posix) or create (windows) a child process and return a live
`ProcessMonitor` for it, or a `ProcessError` if the process could not be
started. Every fallible step of starting the process happens here, before the
monitor exists, so a returned `ProcessMonitor` is always monitoring a running
child. Use it in place of a constructor:

```pony
match StartProcess(sp_auth, bp_auth, consume notifier, path, args, vars)
| let pm: ProcessMonitor => // a live child is running
| let err: ProcessError  => // never started; err says why
end
```

On a `ProcessError` return, no process was started and none of the notifier's
callbacks will fire. On Linux, starting a process requires kernel 5.3 or
newer; on an older kernel, `StartProcess` returns an `UnsupportedKernel`
error.


```pony
primitive val StartProcess
```

## Constructors

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


```pony
new val create()
: StartProcess val^
```

#### Returns

* [StartProcess](process-StartProcess.md) val^

---

## Public Functions

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


Start a child process running the executable at `path`.


```pony
fun box apply(
  auth: StartProcessAuth val,
  backpressure_auth: ApplyReleaseBackpressureAuth val,
  notifier: ProcessNotify iso,
  path: FilePath val,
  args: Array[String val] val,
  vars: Array[String val] val,
  wdir: (FilePath val | None val) = None)
: (ProcessMonitor tag | ProcessError val)
```
#### Parameters

*   auth: [StartProcessAuth](process-StartProcessAuth.md) val
*   backpressure_auth: [ApplyReleaseBackpressureAuth](backpressure-ApplyReleaseBackpressureAuth.md) val
*   notifier: [ProcessNotify](process-ProcessNotify.md) iso
*   path: [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) = None

#### Returns

* ([ProcessMonitor](process-ProcessMonitor.md) tag | [ProcessError](process-ProcessError.md) val)

---

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


```pony
fun box eq(
  that: StartProcess val)
: Bool val
```
#### Parameters

*   that: [StartProcess](process-StartProcess.md) val

#### Returns

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

---

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


```pony
fun box ne(
  that: StartProcess val)
: Bool val
```
#### Parameters

*   that: [StartProcess](process-StartProcess.md) val

#### Returns

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

---

