# `nupp.io.process.spi`
Implementation interface for process transports.
Importing this declaration starts no child. Every operation receives the
retained provider table as its first argument. Options, Exit, and Interest use
the canonical declarations in `nupp.io.process.types`.
Spawn returns the child owner, optional stdin/stdout/stderr handles, process ID,
and optional failure message. Pipes and process lifetime are separate resources:
closeStream releases a pipe, while reap releases the child owner after settlement.
Construct exit results with `nupp.io.process.types.exited` so callers receive the
shared identity and timeout/killed semantics.
Readiness probes must distinguish pending input from EOF and backpressure from a
closed pipe. waitReady services the requested read/write interests and child
completion for a bounded interval; now supplies its monotonic millisecond clock.
Process cleanup must remain valid after cancellation, kill, and partial spawn.
## Types
### `Provider` _interface_
```nupp
interface Provider ...
```
#### Members
| Name | Kind | Description |
| --- | --- | --- |
| [`priority`](#nupp.io.process.spi.Provider.priority) | field | |
| [`spawn`](#nupp.io.process.spi.Provider.spawn) | method | Returns child, stdin, stdout, stderr, pid, and error in that order. |
| [`poll`](#nupp.io.process.spi.Provider.poll) | method | Returns the canonical Exit once available, or nil while the child runs. |
| [`kill`](#nupp.io.process.spi.Provider.kill) | method | Requests termination; the boolean chooses forced termination. |
| [`read`](#nupp.io.process.spi.Provider.read) | method | Reads at most the requested byte count. |
| [`write`](#nupp.io.process.spi.Provider.write) | method | Returns accepted bytes and whether the pipe is gone. |
| [`closeStream`](#nupp.io.process.spi.Provider.closeStream) | method | Releases one pipe handle; repeated release must be harmless. |
| [`reap`](#nupp.io.process.spi.Provider.reap) | method | Releases the settled child owner; repeated release must be harmless. |
| [`now`](#nupp.io.process.spi.Provider.now) | method | Returns monotonic milliseconds for process deadlines. |
| [`waitReady`](#nupp.io.process.spi.Provider.waitReady) | method | Waits for the Interest read/write sets or child completion up to the requested millisecond interval, returning the... |
#### `priority` _field_
```nupp
priority: integer?
```
`@readonly`
#### `spawn` _method_
```nupp
spawn: function(Provider, Options): (any?, any?, any?, any?, integer, string?)
```
`@readonly`
Returns child, stdin, stdout, stderr, pid, and error in that order.
Absent or inherited pipes have nil handles; failure has no child owner.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `Options` | |
##### Returns
| Type | Description |
| --- | --- |
| `any?` | |
| `any?` | |
| `any?` | |
| `any?` | |
| `integer` | |
| `string?` | |
#### `poll` _method_
```nupp
poll: function(Provider, any): (Exit?)
```
`@readonly`
Returns the canonical Exit once available, or nil while the child runs.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
##### Returns
| Type | Description |
| --- | --- |
| `Exit?` | |
#### `kill` _method_
```nupp
kill: function(Provider, any, boolean): nil
```
`@readonly`
Requests termination; the boolean chooses forced termination.
The child still requires settlement and reap.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
| `?` | `boolean` | |
##### Returns
| Type | Description |
| --- | --- |
| `nil` | |
#### `read` _method_
```nupp
read: function(Provider, any, integer): (string?)
```
`@readonly`
Reads at most the requested byte count. An empty string means pending;
nil means EOF. Report transport failures by raising.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
| `?` | `integer` | |
##### Returns
| Type | Description |
| --- | --- |
| `string?` | |
#### `write` _method_
```nupp
write: function(Provider, any, string): (integer, boolean)
```
`@readonly`
Returns accepted bytes and whether the pipe is gone.
Zero bytes with false means backpressure; true means the pipe is closed.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
| `?` | `string` | |
##### Returns
| Type | Description |
| --- | --- |
| `integer` | |
| `boolean` | |
#### `closeStream` _method_
```nupp
closeStream: function(Provider, any): (boolean, string?)
```
`@readonly`
Releases one pipe handle; repeated release must be harmless.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
##### Returns
| Type | Description |
| --- | --- |
| `boolean` | |
| `string?` | |
#### `reap` _method_
```nupp
reap: function(Provider, any): (boolean, string?)
```
`@readonly`
Releases the settled child owner; repeated release must be harmless.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `any` | |
##### Returns
| Type | Description |
| --- | --- |
| `boolean` | |
| `string?` | |
#### `now` _method_
```nupp
now: function(Provider): number
```
`@readonly`
Returns monotonic milliseconds for process deadlines.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
##### Returns
| Type | Description |
| --- | --- |
| `number` | |
#### `waitReady` _method_
```nupp
waitReady: function(Provider, Interest, number): integer
```
`@readonly`
Waits for the Interest read/write sets or child completion up to the
requested millisecond interval, returning the number of ready interests.
##### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `?` | `Provider` | |
| `?` | `Interest` | |
| `?` | `number` | |
##### Returns
| Type | Description |
| --- | --- |
| `integer` | |