Comment by cosmos0072
5 months ago
I found another, possibly simpler solution.
The functions (sh-fd-stdin) (sh-fd-stdout) and (sh-fd-stderr) return the integer file descriptors that a schemesh builtin should use to perform I/O.
With them, you can do
true (lambda () (lisp-expr-writes-to-fd (sh-fd-stdout))) | grep foo | true (lambda () (lisp-expr-reads-from-fd (sh-fd-stdin)))
It should work :)
Could this be abstracted enough with the right macros to make a subset of useful lisp commands play well with the shell? It could be a powerful way to extend the shell for interactive use.
Yes, that's definitely feasible.
I am currently working on it, the macro will be named (shell-expr) and replace the current experimental (shell-test)
[UPDATE] (shell-expr) is ready and kicking :)
Now you can write
An example of such expressions is: For writing to sh-fd-stdout,
For reading from sh-fd-stdin,