~/bend-docscommunity

src/effect.bend relies on unsafe/foreign

raw source on the hub · import snap@1.2.0.0/src/effect.bend as Effect

src/effect: the three foreign effects snap runs programs through. Each is written twice, in C for the native lane and in JS for the interpreter, and each reads a wire the planners in src/argv.bend and src/par.bend make.

1 import
import Base

Effects (foreign code)

effect snaprun.exec source · line 9 · raw

@cmd:String -> IO(String)

the program and its arguments, NUL separated (wire), run with no shell between. The answer is the exit status on its own first line, then stdout and stderr.

foreign: src/exec.c, src/exec.js

effect snaprun.start source · line 18 · raw

@cmd:String -> IO(String)

a program started and left running, answering with its pid, or 0 when it could not be started. The arguments arrive as wire makes them. The effect above waits for what it runs and reads it to the end; this one waits for nothing, and gives the child a session and a /dev/null of its own so it holds no pipe open behind it.

foreign: src/start.c, src/start.js

effect snaprun.par source · line 26 · raw

@cmd:String -> IO(String)

several programs run at once, answering with every exit status in the order the jobs were given. The fields arrive as par.plan joins them. The children write into a directory rather than down a pipe, and par below reads those files back, so this answers statuses alone.

foreign: src/par.c, src/par.js