andrewchambers / janetsh

A powerful new shell that uses the janet programming language for both the implementation and repl.
https://janet-shell.org
MIT License
372 stars 13 forks source link

Coprocess api #170

Closed andrewchambers closed 5 years ago

andrewchambers commented 5 years ago
(sh/coprocess ... ) -> {:job ... :stdin ... :stdout ... stderr ...}

e.g. Expose janetsh over network:

(let [proc (coprocess janetsh)]
  ($ nc -l < (proc :stdout) > (proc :stdin)))

Things like $$ can be implemented in terms of coprocesses.

To implement the coprocess api, we may need to make file descriptor types from shlib that are gcable and can't be closed twice.

andrewchambers commented 5 years ago

I have decided for now, this is worse than an api for explicitly creating/closing pipes.