Phase 2: jobs and history as values, redirections of value commands

- jobs and history are value sources in a pipe; alone they write text.
- < on the first value command of a group, > and >> on the last,
  which then writes lines. A value command after > is an error.
- File errors use fs-error-message, without a stack trace.
- plan.org: Ctrl-C does not cancel a blocking read of a terminal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 07:21:04 +01:00
parent 027acc84e6
commit acd84a2a4c
8 changed files with 252 additions and 71 deletions

View file

@ -275,16 +275,23 @@ the text above:*
its input to the end after the count, so the stage before it can end.
- ~from-json~ reads one document, and gives an array as its values; else
one document per line. ~open~ goes by the extension.
- Value commands with ~&~, with redirections, or with assignments are an
error. A pipe of only value commands runs in the shell, with an empty
input; Ctrl-C stops it with status 130.
- Redirections of value commands: ~<~ on the first of a group, ~>~ and
~>>~ on the last, which then writes lines, not a table. A value command
after one with ~>~ is an error. ~2>~, ~2>&1~, assignments and ~&~ of
value commands are errors.
- A pipe of only value commands runs in the shell, with an empty input
or the file of ~<~. Ctrl-C cancels it with status 130, but only at a
point where a command waits for a value: a read of a terminal or a FIFO
(~li < /dev/tty~) is not cancelled, and goes on until it has a line.
There is no test of Ctrl-C: no value command waits long otherwise.
- ~jobs~ and ~history~ are values in a pipe: records of number, current,
state, command and id; and of number and line. Alone they write text.
- ~2>&1~ is done (phase 3): ~>FILE 2>&1~ works, ~2>&1 >FILE~ is an error.
~>&2~ has no form in ~(std run)~ yet.
- Not done: ~jobs~ and ~history~ as values, and ~echo~. A value ~echo~
would take the name from ~/bin/echo~, which decision 4 does not allow;
to decide.
- Tests: ~tests/values.bjo~ (40); ~tests/run.bjo~ (34);
~tests/interactive.bjo~ (10).
- Not done: ~echo~. A value ~echo~ would take the name from ~/bin/echo~,
which decision 4 does not allow; to decide.
- Tests: ~tests/values.bjo~ (51); ~tests/run.bjo~ (34);
~tests/interactive.bjo~ (12).
** Phase 3: more POSIX, and the rest of the edges