Skip to content

Conversation

@NoamGaash
Copy link
Contributor

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

@NoamGaash
Copy link
Contributor Author

@Almenon

Copy link
Collaborator

@Almenon Almenon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting the PR! It's a good start. If you want to I can make the below changes, or you can take a shot at them:

  • Check your returns, some of them aren't needed.
  • Having a callback in addition to a promise might be confusing to the person using the API. I'm assuming you left it in as to not cause breaking changes, which is good practice, but the return value is already changed, which means a major semver update. As long as we're making changes lets get rid of the callback param.
  • for consistency it would be good to promisify the runstring method as well.

@NoamGaash
Copy link
Contributor Author

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 NoamGaash requested a review from Almenon December 29, 2022 15:03
@Almenon
Copy link
Collaborator

Almenon commented Jan 16, 2023

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

@Almenon
Copy link
Collaborator

Almenon commented Jan 16, 2023

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
Copy link
Collaborator

Almenon commented Feb 11, 2023

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 Almenon merged commit 4c9e327 into extrabacon:master Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants