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

@ -48,6 +48,10 @@
"printf 'echo status $?\\r'" "sleep 0.5"
"printf 'ech'" "sleep 0.3" "printf '\\032'" "sleep 0.5"
"printf 'o alive\\r'" "sleep 0.5"
"printf 'sleep 30 &\\r'" "sleep 1"
"printf 'jobs | g command\\r'" "sleep 1"
"printf 'history | tl 1 | g line\\r'" "sleep 1"
"printf 'kill %%1\\r'" "sleep 0.5"
"printf 'printf x | u\\r'" "sleep 1"
"printf 'stty tostop; printf y | u; stty -tostop\\r'" "sleep 1"
"printf 'exit\\r'" "sleep 1"]
@ -63,6 +67,9 @@
(expect-true "Ctrl-C ends a job, and the prompt starts a new line" (string-contains? out "^C\n"))
(expect-true "with status 130" (string-contains? out "status 130"))
(expect-true "Ctrl-Z at the prompt does not stop the shell" (string-contains? out "\nalive\n"))
(expect-true "jobs in a pipe" (string-contains? out "jobs | g command\nsleep 30\n"))
(expect-true "history in a pipe, with this line last"
(string-contains? out "history | tl 1 | g line\nhistory | tl 1 | g line\n"))
(expect-true "a value command at the end of a job" (string-contains? out "printf x | u\nx\n"))
(expect-true "and with tostop set" (string-contains? out "stty -tostop\ny\n"))
(expect-true "the history is saved"