You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
KenM76
committed
v0.9.0: run-script as a clean Unix filter — ScriptArgs, Stdin, stderr separation
Closes TWO FRs that compose into one story:
- FR_runscript_script_args.md (argv channel via ScriptArgs global)
- FR_runscript_stdin_and_stderr_separation.md (Stdin global + stop
redirecting Console.Error to the output writer)
The Args FR had been misfiled to Complete/ at some point without code
actually shipping — verified by repo-wide grep for ScriptArgs returning
zero matches. v0.9.0 ships both together because they compose: a .csx
becomes a proper stdin->stdout(data) + stderr(diag) filter with argv
in and exit code out (the exit-code FR shipped in v0.8.2). The
SWBomExcluded ScripTree provider can now retire its PowerShell
wrapper shim.
Architecture:
- New IScriptContext interface in ComBridge.Core with ScriptArgs
(string[]) and Stdin (string) properties.
- Every shipped plugin's globals class (SwGlobals, ExcelGlobals,
WdGlobals, PptGlobals, OlGlobals + 4 Mac variants) implements
IScriptContext.
- RunScriptCommand populates both fields after CreateGlobals but
before invoking the host.
- ScriptArgs = args.Skip(1).ToArray() — everything between the script
path and the trailing output-file positional.
- Stdin = ReadStdinWithTimeoutAsync(250ms) via the underlying
Console.OpenStandardInput() stream + CancellationToken, extended
per chunk so slow producers aren't truncated.
- ScriptHost.RunAsync no longer calls Console.SetError — script
stderr flows to the process's real stderr.
Hang trap caught during smoke-test:
if (Console.IsInputRedirected) ReadToEndAsync()
hangs forever when stdin is inherited-but-empty (combridge invoked
from bash subprocesses, Task Scheduler, CI runners). IsInputRedirected
returns true for "non-terminal" — NOT "has data available." Test 1
(no pipe) sat at ReadToEndAsync >30s before being killed. Fix:
cancellation-token timeout pattern. Captured as
lesson_20260615_console_isinputredirected_inherited_handle_hang.md
in personal_rag/claude_code/.
Verified end-to-end against running SW 2026:
Test 1 (no pipe, args only) → ScriptArgs.Length=5, exit 5, no hang
Test 2 (real pipe) → 66 bytes received, exit 0
Test 3 (stderr split) → STDOUT to <out>, STDERR to real stderr
Test 4 (full filter) → clean JSON on stdout, diag on stderr,
args + stdin parsed, exit 0
Mirrored to D:\Dev\ScripTree\lib\combridge\ and
R:\ScripTree\lib\combridge\ per the CLAUDE.md deployment mandate.
Both FRs in Complete/ with implementation log stamps. The Args FR's
"misfiled" history captured in its own log for the next reader.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments