Hi, I'm looking for feedback on my redesign of osproc, which can be found here: https://github.com/alaviss/nim-sys/blob/features/exec-prototype/src/sys/exec.nim
The guiding principles for this design are:
What's in the prototype:
What's not in the prototype:
All questions and feedback are appreciated, regardless of your familiarity with the subject of process execution/management.
This work is a part of my nim-sys project, which serves as my experimental ground for evolving the Nim standard library.
What are your inspirations for your design?
My main inspirations are Go's os/exec and Rust's std::process, with a sprinkle of Python's subprocess and Node's child_process.
Have you tried replacing shell scripts?
It's untested for now, but the flexibility it provides is similar to a shell as far as my usage are concerned.
How do you handle errors with a piping intention?
Piping between two programs can simply be done via a (not implemented yet, but trivial) pipe(a, b: Launcher): tuple[a, b: Result[Process]], since it is as simple as passing two ends of a pipe into two processes. Errors during launch will be reported via each Result[Process], and Process itself holds the means to get the exit code (asynchronously, even), which you can use to keep track of each ends of the pipe.
I have not decided on how the interprocess piping API work yet, so if you have any ideas please chime in :)