Use spawn instead of execFile (#27)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* [WIP]: just use spawn instead of execFile childProcess.execFile pays no attention `opts.stdio`. `execa.spawn` allows you to set `opts.stdio` options, but it doesn't return a promise. I think we should forgoe using `childProcess.execFile` and just use spawn. We can reimplement much of `execFile`s utility ourself. Rather than having two separate methods `spawn` and `execFile` - I think we should work towards a single method. What options the user sets for `opts.stdio` or `opts.stdin`, etc; Those should determine whether or not the stream is buffered and made part of the promise result, or if they are just streamed (or sent to an Observable), or ignored. This simplifies the API, and offers potentially far more control. Want to use streams/observables for `stdout` because you know it will contain lots of data and you don't want to buffer, but it would nice to just have `stderr` buffered for you to print in case of an error? That would be doable this way, and really separates it from child_process. childProcess.execFile is really just a wrapper around spawn anyways. It's main utility is that in concats `stdio` and `stdout`. Which is pretty easy for us to achieve on our own using `get-stream` This reimplements nearly all of the functionality of execFile. Remaining items to be feature complete with execFile: - [ ] timeout support (should be easy to add back). - [ ] errname resolution. See TODO note on that. I'm not sure we want to use `process.bind('uv')`. I don't really know what it does. - [ ] some stream cleanup code (see childProces.execFile's internal `kill` method. It calls `stream.destroy()`. I am not sure how that will affect `get-stream`) * use regex test so I can see what went wrong on Windows * remove leading `./` - If this fixes windows, we should figure out why. * Why? Why? Why Windows??? Why does this make the tests pass? Could you possibly make the error output any more cryptic? I don't understand you Windows! We are not friends anymore. * deprecate execa.spawn * tweaks * more tweaks * update deprecation message
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+83 added−34 removed
- other:+83 added−34 removed