Skip to content

Add pipe device file#822

Merged
vinc merged 12 commits into
trunkfrom
feature/pipe
Apr 3, 2026
Merged

Add pipe device file#822
vinc merged 12 commits into
trunkfrom
feature/pipe

Conversation

@vinc

@vinc vinc commented Apr 1, 2026

Copy link
Copy Markdown
Owner

This PR implements a pipe with a shared buffer acting as a queue accessible at /dev/pipe. When a file handle to a pipe is duplicated, both handles share the same buffer. Data written to one handle can be read from the other, and reading consumes the data.

@vinc

vinc commented Apr 1, 2026

Copy link
Copy Markdown
Owner Author

In MOROS Lisp the (shell <cmd>) function returns the exit status of the command, and now we can capture the output of the command with (shell->binary <cmd>):

~
> lisp
MOROS Lisp v0.7.0

> (str/trim (bin->str (shell->binary "date")))
"2026-04-01 20:09:20 +0200"

@vinc

vinc commented Apr 1, 2026

Copy link
Copy Markdown
Owner Author

When the draw command was introduced in #790 with the option to display the result of a command at periodic intervals we used a redirection to a temporary file, which resulted in changes needed to better handle file deletions in #820, but now we can skip the temporary file and just use a pipe.

@vinc

vinc commented Apr 1, 2026

Copy link
Copy Markdown
Owner Author

And now, command substitutions in the shell!

~
> copy hello.txt hello-$(date %Y%m%d)-$(date %H%M%S).txt

~
> list
14 2026-04-01 18:01:42 hello-20260401-180142.txt
14 2026-04-01 17:12:52 hello.txt

@vinc vinc marked this pull request as ready for review April 3, 2026 18:10
@vinc vinc merged commit a385b1b into trunk Apr 3, 2026
1 check passed
@vinc vinc deleted the feature/pipe branch April 3, 2026 18:12
@vinc vinc mentioned this pull request Apr 6, 2026
@vinc vinc mentioned this pull request Apr 17, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant