From c4dcbbdc2654a3d1f20147608b7aee70e260bf3f Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:04:16 +0000 Subject: [PATCH] PROPOSALS: what a shell needs of Sys, for concha --- diff --git a/PROPOSALS.md b/PROPOSALS.md index b1c5851..4b19e2b 100644 --- a/PROPOSALS.md +++ b/PROPOSALS.md @@ -368,3 +368,125 @@ `ret` does. D's experience is that the corners (fields, generics, procedure values) take years; the narrow form here leaves record lifetimes out, and so the first false alarm above, on purpose. + +## What a shell needs of `Sys` + +For concha, the shell written in raz. `examples/Sh.raz` shows how far +`Sys` goes today: pipelines, `<`, `>`, `>>` and `2>`, and job control +through `spawn`'s `group` and `foreground`. A shell people use every +day needs more. Each item below is library growth that breaks no +program, and each has a C call behind it, for `Sys.raz` over the C +library. + +**Moving file descriptors.** `2>&1`, `3>log`, `exec >out` and `{ a; +b; } >f` move or copy the shell's own descriptors, around a builtin +or for good; `Program.fds` covers only a child's first three. + +``` +proc dup*(fd: INT): INT; (* a new fd for the same file, the lowest free *) +proc dupTo*(fd, to: INT): INT; (* to made the same file as fd, closing what it was *) +proc keepOnExec*(fd: INT; yes: BOOL): INT; (* fd passed to programs spawn starts, or not *) +``` + +`Program` gains `more*: []INT`, descriptors passed on to the program +at the same numbers, for `3