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.

Module contents

Types

TypeKindDescription
Providerinterface

Types#

Providerinterface#

interface Provider ...

Members

NameKindDescription
priorityfield
spawnmethodReturns child, stdin, stdout, stderr, pid, and error in that order.
pollmethodReturns the canonical Exit once available, or nil while the child runs.
killmethodRequests termination; the boolean chooses forced termination.
readmethodReads at most the requested byte count.
writemethodReturns accepted bytes and whether the pipe is gone.
closeStreammethodReleases one pipe handle; repeated release must be harmless.
reapmethodReleases the settled child owner; repeated release must be harmless.
nowmethodReturns monotonic milliseconds for process deadlines.
waitReadymethodWaits for the Interest read/write sets or child completion up to the requested millisecond interval, returning the...

priorityfield#

priority: integer?
@readonly

spawnmethod#

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
NameTypeDescription
?Provider
?Options
Returns
TypeDescription
any?
any?
any?
any?
integer
string?

pollmethod#

poll: function(Provider, any): (Exit?)
@readonly

Returns the canonical Exit once available, or nil while the child runs.

Arguments
NameTypeDescription
?Provider
?any
Returns
TypeDescription
Exit?

killmethod#

kill: function(Provider, any, boolean): nil
@readonly

Requests termination; the boolean chooses forced termination. The child still requires settlement and reap.

Arguments
NameTypeDescription
?Provider
?any
?boolean
Returns
TypeDescription
nil

readmethod#

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
NameTypeDescription
?Provider
?any
?integer
Returns
TypeDescription
string?

writemethod#

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
NameTypeDescription
?Provider
?any
?string
Returns
TypeDescription
integer
boolean

closeStreammethod#

closeStream: function(Provider, any): (boolean, string?)
@readonly

Releases one pipe handle; repeated release must be harmless.

Arguments
NameTypeDescription
?Provider
?any
Returns
TypeDescription
boolean
string?

reapmethod#

reap: function(Provider, any): (boolean, string?)
@readonly

Releases the settled child owner; repeated release must be harmless.

Arguments
NameTypeDescription
?Provider
?any
Returns
TypeDescription
boolean
string?

nowmethod#

now: function(Provider): number
@readonly

Returns monotonic milliseconds for process deadlines.

Arguments
NameTypeDescription
?Provider
Returns
TypeDescription
number

waitReadymethod#

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
NameTypeDescription
?Provider
?Interest
?number
Returns
TypeDescription
integer