python-shell
python-shell copied to clipboard
feat: promisify the "run" command
that's my humble attempt to solve issue #77 thanks for making and maintaining this repo
@Almenon
I believe I have found a way to support both the legacy callback-based API and the newer promise-based one. I believe my implementation has two main drawbacks:
- The promise-based implementation cant support providing both stdout and stderr. a promise cannot be both resolved and rejected.
- I didn't find a solution for marking specific argument as deprecated, therefore I abuse the console.warning interface
Sorry for the delay, I do intend on getting to this eventually.
The problem with trying to support both approaches is that the typing doesn't work out. If you use .then typescript complains because the return value might not be a promise. There might be some fancy typescript syntax for solving this, but I'm just going to simplify and remove the callback option for the next major release. I'm presuming that's fine?
https://i.imgur.com/3dV1D5p.png
I'm going to merge this in, publish as v4 so you have your changes, and then make some changes I want to make w/ a v5 release.