2022-06-09 17:24:02 +00:00
|
|
|
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
|
|
|
# SPDX-License-Identifier: Unlicense
|
|
|
|
|
|
|
|
import std/[asyncdispatch, os]
|
|
|
|
import preserves, syndicate, syndicate/capabilities
|
|
|
|
|
|
|
|
proc unixSocketPath: string =
|
|
|
|
result = getEnv("SYNDICATE_SOCK")
|
|
|
|
if result == "":
|
|
|
|
result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
|
|
|
|
|
|
|
bootDataspace("main") do (root: Ref; turn: var Turn):
|
|
|
|
let label = getAppFilename().extractFilename
|
2023-04-10 15:29:22 +00:00
|
|
|
connectUnix(turn, unixSocketPath(), capabilities.mint()) do (turn: var Turn; ds: Ref):
|
2022-06-09 17:24:02 +00:00
|
|
|
var a = initRecord[Ref](label, commandLineParams().toPreserve(Ref))
|
|
|
|
message(turn, ds, a)
|
|
|
|
|
|
|
|
for i in 0..7: poll(20)
|
|
|
|
# A hack to exit
|