UnixInstance
Defined in: packages/core/src/kernel/types.ts:2204
A live, booted system — the handle returned by a runtime’s boot().
Consumed — obtain one from UnixBuilder.boot(runtime) or runtime.boot(image). Not an interface user code implements.
Remarks
Section titled “Remarks”A UnixInstance is a single running system. boot() starts the shell as
PID 1 and resolves when it exits; shutdown() performs an orderly teardown
(SIGTERM to all → grace period → SIGKILL). The kernel reference is
primarily for inspection and tests — bins should go through ProcContext.
Caveat
Section titled “Caveat”[Symbol.asyncDispose] is implemented so you can use await using —
this calls shutdown(), so DO NOT put the instance into a long-lived
scope bound to using unless you actually want teardown on scope exit.
Example
Section titled “Example”import { Unix, stdSystem } from '@fishnet/core'import { nodeRuntime } from '@fishnet/runtime'
await using sys = await Unix().use(stdSystem()).boot(nodeRuntime())const code = await sys.wait()- UnixBuilder.boot
- BootOpts
- Kernel
Properties
Section titled “Properties”kernel
Section titled “kernel”
readonlykernel:Kernel
Defined in: packages/core/src/kernel/types.ts:2236
Access kernel for inspection/testing.
Methods
Section titled “Methods”[asyncDispose]()
Section titled “[asyncDispose]()”[asyncDispose]():
Promise<void>
Defined in: packages/core/src/kernel/types.ts:2233
Async disposable — delegates to shutdown().
Returns
Section titled “Returns”Promise<void>
boot()
Section titled “boot()”boot():
Promise<ExitCode>
Defined in: packages/core/src/kernel/types.ts:2211
Boot a shell as PID 1. Resolves with the shell’s exit code.
Returns
Section titled “Returns”Promise<ExitCode>
Invariant
Section titled “Invariant”The kernel keeps running after the shell exits (services may
outlive it); call shutdown() to tear everything down
shutdown()
Section titled “shutdown()”shutdown():
Promise<void>
Defined in: packages/core/src/kernel/types.ts:2230
Gracefully shut down the system.
Returns
Section titled “Returns”Promise<void>
Invariant
Section titled “Invariant”SIGTERM → configured grace period → SIGKILL; resolves only after all processes are reaped
spawn()
Section titled “spawn()”spawn(
bin,argv?,opts?):Promise<ChildHandle>
Defined in: packages/core/src/kernel/types.ts:2219
Spawn any bin as a top-level process (ppid=0).
Parameters
Section titled “Parameters”string | BinFunction
string[]
Returns
Section titled “Returns”Promise<ChildHandle>
Invariant
Section titled “Invariant”Runs independently of the shell; the bin’s exit does NOT shut
down the instance — call shutdown() explicitly
wait()
Section titled “wait()”wait():
Promise<ExitCode>
Defined in: packages/core/src/kernel/types.ts:2222
Wait for the system to shut down (shell exit).
Returns
Section titled “Returns”Promise<ExitCode>