pandastrike / fairmont-process

Functional reactive programming in JavaScript and CoffeeScript
ISC License
0 stars 2 forks source link

Use child_process.spawn() and RFP to build "shell()" #3

Open freeformflow opened 9 years ago

freeformflow commented 9 years ago

As I documented in our API docs for shell(), it is based off of Node's child_process.exec() which returns a buffer after the Unix command is complete. This has a couple of downsides. It limits the size of the output, and keeps you from being able to know anything about the Unix command's execution during runtime.

I noticed during my research that child_process.spawn() produces an output stream that passes along data as it becomes available, overcoming both limitations of exec I propose that we change shell or create another command that treats spawn()'s stream as a producer and gives us access under a RFP framework.

dyoder commented 9 years ago

Or just expose stdio and stdout as streams, since it is now trivial to convert a stream into a reactor (via stream). In fact, since you can just pipe them to process.stdout and process.stderr, I'm not really sure why I didn't just do that to begin with.