msg: make the SturdyRef overrideable with $SYNDICATE_STEP
This commit is contained in:
parent
e898bc62db
commit
df421db071
|
@ -12,7 +12,8 @@ Do not send messages immediately to the dataspace passed `json_socket_translator
|
||||||
|
|
||||||
## msg
|
## msg
|
||||||
|
|
||||||
A utility that sends a message to $SYNDICATE_SOCK in the form `<ARGV…>`.
|
A utility that sends a message to `$SYNDICATE_SOCK` in the form `<ARGV0 ARG1 … ARGVn>`.
|
||||||
|
The `$SYNDICATE_STEP` variables sets the SturdyRef capability with a default to the SturdyRef generated by `<ref { oid: "syndicate" key: #x"" }>`.
|
||||||
|
|
||||||
## preserve_process_environment
|
## preserve_process_environment
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,15 @@ proc unixSocketPath: Unix =
|
||||||
if result.path == "":
|
if result.path == "":
|
||||||
result.path = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
result.path = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
||||||
|
|
||||||
|
proc envStep: Preserve[Ref] =
|
||||||
|
var s = getEnv("SYNDICATE_STEP")
|
||||||
|
if s != "": parsePreserves(s, Ref)
|
||||||
|
else: capabilities.mint().toPreserve(Ref)
|
||||||
|
|
||||||
proc main =
|
proc main =
|
||||||
let label = getAppFilename().extractFilename
|
let label = getAppFilename().extractFilename
|
||||||
bootDataspace(label) do (root: Ref; turn: var Turn):
|
bootDataspace(label) do (root: Ref; turn: var Turn):
|
||||||
connect(turn, unixSocketPath(), capabilities.mint().toPreserve(Ref)) do (turn: var Turn; ds: Ref):
|
connect(turn, unixSocketPath(), envStep()) do (turn: var Turn; ds: Ref):
|
||||||
message(turn, ds, initRecord(label, map(commandLineParams(), parsePreserves)))
|
message(turn, ds, initRecord(label, map(commandLineParams(), parsePreserves)))
|
||||||
|
|
||||||
for i in 0..3: poll(20)
|
for i in 0..3: poll(20)
|
||||||
|
|
Loading…
Reference in New Issue