https://gitlab.synchro.net/main/sbbs/-/commit/b469dbeb1af56e3c9bf40760
Added Files:
src/syncterm/run_wren.sh
Modified Files:
src/syncterm/Manual.txt Wren.adoc src/syncterm/scripts/syncterm.wren wrentest.wren src/syncterm/syncterm.c syncterm.man.in wren_bind.c wren_bind_conn.c wren_bind_conn.h wren_host.c wren_host.h
Log Message:
SyncTERM: -W flag for command-line Wren script load + harness
Adds a way to compile / execute a Wren script under SyncTERM headlessly,
useful for CI / pre-commit gating and for ad-hoc developer tests.
-W <path> New CLI flag. Stores the path via
wren_host_set_launch_script(); wren_host_init runs
load_one_script() on it after the embedded + user
auto-load chain has finished, so its imports
resolve against the full surface. Skips the load
when wrenHasModule() reports the filename-derived
module already loaded -- common when the file is
symlinked into the user-dir scripts/ tree or
pulled in by an `import` from another module
(e.g. auto/connected/runtests.wren importing
"wrentest"). Compile / runtime errors print
"[wren] ..." to stderr via the existing errorFn.
Host.launchScript Returns the -W path (or null) so a script that's
also embedded for normal Alt+key dispatch can
detect command-line invocation and run itself
immediately, without relying on coincidental
signals like the BBS URL. wrentest.wren uses
this to fire WrenTest.run() when invoked via -W
while leaving Alt+T behavior unchanged.
Host.print(s) Write a string + newline to actual stdout (and
fflush). Distinct from System.print(s), which
is captured by the Wren console log buffer.
Intended for scripts run under -W that need to
report progress / results to the launching shell.
run_wren.sh Tiny harness modeled after run_termtest.sh. Takes
a Wren script path; invokes the gmake-default
debug binary (clang.freebsd.amd64.exe.debug/
syncterm) with -iS -S -Q -W <script>
shell:/usr/bin/true under SDL offscreen. Exits
1 if any "[wren] " line hits stderr, 0 otherwise
-- decoupled from SyncTERM's own exit code, which
is unchanged. Override the binary by setting the
SYNCTERM env var (alternate BUILDPATH, etc.).
wrentest.wren picks up Host as an import, routes its 5 progress / fail
/ summary System.print calls through a new print_(s) static that
dispatches to Host.print whenever Host.launchScript is set, and adds a top-level guard that calls WrenTest.run() when invoked via -W. The
two Console-test probes that specifically validate System.print's
log-append behavior keep calling System.print directly.
Documentation: -w/-W entries added to the usage string, syncterm.man.in synopsis + options, and Manual.txt; Wren.adoc Host section gains
launchScript / print rows plus a NOTE on the System section pointing
readers at Host.print for stdout output.
Co-Authored-By: Claude Opus 4.7 (1M context) <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net