RecurLoop/ Documentation
Shell/Guidesv0.2.12

Shell

Run external programs, connect pipelines and capture their output from RecurLoop. Shell passes argument vectors to programs; it does not delegate each command to another shell.

Choose the right operation

OperationWhere to use itResult
runtop level or a typed functionexit status
capturetop level or a typed functionstandard output
spawninside a typed functionowned Shell:Invocation*
Shell:Pipelinecomputed argument listsowned pipeline object
recurloop
import shell
run printf "hello\n" | tr a-z A-Z
assert status == 0

The output is HELLO. At top level status is a runtime binding. Inside a typed function, assign the return value of run instead of reading that binding.

Do not free borrowed Invocation:stdout text. Do free the string returned by capture inside a typed function. The two APIs deliberately have different ownership.

Learning path

  1. Commands — Quote arguments and select command syntax.
  2. Pipelines — Connect streams and handle stage failures.
  3. Capture and jobs — Collect output and inspect running invocations.
  4. Command objects — Construct commands from runtime data.
  5. Process settings — Scope process settings and coordinate parallel jobs.