~/bend-docscommunity

process.bend relies on unsafe/foreign

raw source on the hub · import bend-kit-process@0.5.0.1/process.bend as MProcess

Subprocesses and process-level OS access, with byte-exact input and output.

2 imports
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

Definitions

def stdin.read source · line 33 · raw

@max:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)

def exit source · line 41 · raw

@code:U32 -> IO(Unit)

def run.result source · line 65 · raw

@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes))>

def run source · line 73 · raw

@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> @cwd:String -> @stdin:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes))>)

Effects (foreign code)

effect run.raw source · line 9 · raw

@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> @cwd: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. cwd is the child's directory; relative paths start at the parent's directory.

foreign: effs/process.c, effs/process.js

effect spawn source · line 17 · raw

@cmd:String -> @args:List<&2, String> -> @env:List<&2, String> -> @cwd: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 24 · raw

@pid:U32 -> IO(Result<&1, &1, Pair(U32, String), U32>)

Reaps a spawned child. A signaled child has status 128 + signal number. pid is 1..2147483647; 0 and larger are EINVAL, never group/any-child selectors.

foreign: effs/process.c, effs/process.js

effect read_stdin source · line 29 · 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 37 · raw

@code:U32 -> IO(Unit)

Terminates this program with the supplied status.

foreign: effs/process.c, effs/process.js

effect cwd source · line 44 · raw

IO(Result<&1, &1, Pair(U32, String), String>)

foreign: effs/process.c, effs/process.js

effect chdir source · line 48 · raw

@path:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)

foreign: effs/process.c, effs/process.js

effect hostname source · line 52 · raw

IO(Result<&1, &1, Pair(U32, String), String>)

foreign: effs/process.c, effs/process.js

effect pid source · line 56 · raw

IO(U32)

foreign: effs/process.c, effs/process.js

effect signal.poll source · line 61 · raw

IO(U32)

Install SIGINT/SIGTERM handlers and take one pending event; 0 means none.

foreign: effs/process.c, effs/process.js