March Docs

Host

host.march — Scroll's access to the operating system.

Since March 0.8.0 every checked operation (environment, files, processes, Vault) returns an outer Result(_, CapError) saying whether the launch authority permitted it. Scroll's main requests everything it uses in its needs clause, so a refusal means the server was launched with a narrowed grant it cannot work under: these wrappers stop with a clear message rather than threading CapError through the whole server. The inner results (File.FileError, ProcessError, ...) are returned unchanged.

Functions

fnappendappend(path : String, data : String) : Result((), File.FileError) do must(File.append(path, data)) end#
fnargvargv() : List(String) do must(System.argv()) end#
fncwdcwd() : String do must(System.cwd()) end#
fndeletedelete(path : String) : Result((), File.FileError) do must(File.delete(path)) end#
fnenvenv(name : String) : Option(String) do must(System.env(name)) end#
fnexistsexists(path : String) : Bool do must(File.exists(path)) end#
fnmust_unitmust_unit(r : Result((), CapError)) : Unit do must(r) end#

Stop when a whole-program operation such as HttpServer.listen is refused.

fnns_dropns_drop(ns : String, key : String) : Unit do must(Vault.ns_drop(ns, key)) end#
fnns_getns_get(ns : String, key : String) : Option(String) do must(Vault.ns_get(ns, key)) end#
fnns_setns_set(ns : String, key : String, value : String) : Unit do must(Vault.ns_set(ns, key, value)) end#
fnpidpid() : Int do must(System.pid()) end#
fnproc_dropproc_drop(key : String) : Unit do must(Vault.ns_drop(procs_ns(), key)) end#
fnproc_getproc_get(key : String) : Option(Process) do must(Vault.ns_get(procs_ns(), key)) end#
fnproc_setproc_set(key : String, p : Process) : Unit do must(Vault.ns_set(procs_ns(), key, p)) end#
fnreadread(path : String) : Result(String, File.FileError) do must(File.read(path)) end#
fnrunrun(cmd : String, args : List(String)) : Result(ProcessResult, String)#
fnspawn_asyncspawn_async(cmd : String, args : List(String)) : Result(Process, String)#
fnwritewrite(path : String, data : String) : Result((), File.FileError) do must(File.write(path, data)) end#