process.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-process@0.2.0.0/process.bend as MProcess
Subprocesses and process-level OS access, with byte-exact input and output.
2 imports
import Base import 0x49814d83de8f70993a43e1002be29ecd/bytes.bend as Bytes
Definitions
def stdin.read source · line 30 · raw
@max:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
def exit source · line 38 · raw
@code:U32 -> IO(Unit)
def run.result source · line 62 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes))>
def run source · line 70 · raw
@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> @stdin:0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes))>)
Effects (foreign code)
effect run.raw source · line 8 · raw
@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> @stdin:String -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))>)
Environment entries are KEY=VALUE; they override inherited variables. The command is an executable name or path, never a shell expression. Exit status is 0..255, or 128 + the terminating signal number.
foreign: effs/process.c, effs/process.js
effect spawn source · line 15 · raw
@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Pair(File, Pair(File, File)))>)
A streaming child: pid, writable stdin, readable stdout and stderr. Close stdin to send EOF; drain both outputs before wait to avoid pipe deadlock.
foreign: effs/process.c, effs/process.js
effect wait source · line 21 · raw
@pid:U32 -> IO(Result<&1, &1, Pair(U32, String), U32>)
Reaps a spawned child. A signaled child has status 128 + signal number.
foreign: effs/process.c, effs/process.js
effect read_stdin source · line 26 · raw
@max:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
Read up to max bytes from this program's standard input; empty at EOF.
foreign: effs/process.c, effs/process.js
effect exit.raw source · line 34 · raw
@code:U32 -> IO(Unit)
Terminates this program with the supplied status.
foreign: effs/process.c, effs/process.js
effect cwd source · line 41 · raw
IO(Result<&1, &1, Pair(U32, String), String>)
foreign: effs/process.c, effs/process.js
effect chdir source · line 45 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
foreign: effs/process.c, effs/process.js
effect hostname source · line 49 · raw
IO(Result<&1, &1, Pair(U32, String), String>)
foreign: effs/process.c, effs/process.js
effect pid source · line 53 · raw
IO(U32)
foreign: effs/process.c, effs/process.js
effect signal.poll source · line 58 · raw
IO(U32)
Install SIGINT/SIGTERM handlers and take one pending event; 0 means none.
foreign: effs/process.c, effs/process.js