refactor(sterni/blërg): runExecline is dead, long live Run Execline

Remember //nix/escapeExecline? Well, this is worse (for some possible
meanings of the word). Instead of taking a list and escaping/rendering
it to an execline script, Execline reimplements part of execlineb(1):

It takes a (nested) list where any enclosed list signifies an execline
block and produces the corresponding execline argv form as described in
execline-block(7). This means the result of Execline can directly be
executed using •SH without the need for execlineb(1).

Consequently, execlineb(1)'s management of positional parameters and the
environment are not available. This is fine for the intended purpose of
Execline (glueing together shell commands efficiently without messing
around with the FFI in BQN for pipe(2) etc.).

Change-Id: Ief69b1bab919c16b6e39c3f5dc3db628766c5a8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13180
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
sterni 2025-02-20 23:06:50 +01:00 committed by clbot
parent a2e78b62ff
commit 8a9fb693e3

View file

@ -39,6 +39,16 @@ Run ← {
R {𝕊 exitstdoutstderr: stderr!0=exit stdout}Run
LR LinesR
# see execline-block(7)
Execline {
# Not a string nor any other list
𝕩: 0•Type𝕩? •Fmt 𝕩;
# List, but not a string (i.e. block)
𝕩: 2•Type𝕩? ""˜(' '¨ 𝕊)¨𝕩;
# String (i.e. arg)
𝕩
}¨
GetEnv {R "importas""env"𝕩"printf""%s""$env"}
RelPath •wdpath•file.At
@ -88,9 +98,8 @@ converters ← ⍉>⟨
"org", "pandoc""-f""org""-t""html5",
# TODO(sterni): don't assemble blocks in this ad hoc fashion
# TODO(sterni): pipefail
PipelineCmd {"pipeline"(' '¨𝕨)""𝕩}
PipelineCmd {Execline "pipeline"𝕨𝕩}
GitBackend {𝕊 config:
repo RelPath config j.ObjGet "repository"