~/bend-docscommunity

domain/architecture/system/effs/io.bend relies on unsafe/foreign

raw source on the hub · import 0x635d6b0e0ec6a1b1f1319bf06aa496d9/domain/architecture/system/effs/io.bend as Io

1 import
import Base

Definitions

def out_of source · line 12 · raw

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

def ok_of source · line 19 · raw

@r:Result<&1, &1, Pair(U32, String), String> -> Bool

def run source · line 27 · raw

@cmd:String -> @args:List<&2, String> -> IO(String)

A program's standard output when it exits 0, else "".

def succeeds source · line 33 · raw

@cmd:String -> @args:List<&2, String> -> IO(Bool)

Whether a program exits 0.

def home source · line 38 · raw

IO(String)

def size_of source · line 44 · raw

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

---- reading a file: its text, or "" when it cannot be read ----

def text_of source · line 51 · raw

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

def read_done source · line 58 · raw

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

def read_sized source · line 65 · raw

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

def read_opened source · line 72 · raw

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

def read_head_opened source · line 81 · raw

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

def read_head source · line 91 · raw

@path:String -> @max:U32 -> IO(String)

The first max bytes of a file ("" if unreadable): enough for what sits at its top, like imports.

def read source · line 96 · raw

@path:String -> IO(String)

def after_write source · line 102 · raw

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

---- writing a file ----

def write_opened source · line 107 · raw

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

def write source · line 116 · raw

@path:String -> @text:String -> IO(Unit)

def keep_filled source · line 121 · raw

@c:Bool -> @x:String -> @rest:List<&2, String> -> List<&2, String>

def nonempty source · line 129 · raw

@xs:List<&2, String> -> List<&2, String>

The trimmed, non-empty strings.

Effects (foreign code)

effect Program.run source · line 8 · raw

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

---- running a program ---- Temporary: bend-kit-process does this, but no Bend version runs both it (2.0.27 only) and bend-kit-files (2.0.28+).

foreign: domain/architecture/system/effs/program_run.c, domain/architecture/system/effs/program_run.js