python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

feat: promisify the "run" command

Open NoamGaash opened this issue 3 years ago • 2 comments

that's my humble attempt to solve issue #77 thanks for making and maintaining this repo

NoamGaash avatar May 31 '22 19:05 NoamGaash

@Almenon

NoamGaash avatar Jun 04 '22 17:06 NoamGaash

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:

  1. The promise-based implementation cant support providing both stdout and stderr. a promise cannot be both resolved and rejected.
  2. I didn't find a solution for marking specific argument as deprecated, therefore I abuse the console.warning interface

NoamGaash avatar Oct 13 '22 13:10 NoamGaash

Sorry for the delay, I do intend on getting to this eventually.

Almenon avatar Jan 16 '23 00:01 Almenon

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

Almenon avatar Jan 16 '23 05:01 Almenon

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.

Almenon avatar Feb 11 '23 04:02 Almenon