-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.pipe
signature change
#949
Comments
Agreed. I have a script in CI that broke because of this change. The docs do not make reference to this change, and I believe the third example in the |
We'll update the example: $`printf "hello"`
.pipe($`awk '{printf $1", world!"}'`)
.pipe($`tr '[a-z]' '[A-Z]'`)
// →
$`printf "hello"`
.pipe`awk '{printf $1", world!"}'`
.pipe`tr '[a-z]' '[A-Z]'` |
Smth like this maybe, but I'm not sure: const _pipe = ProcessPromise.prototype.pipe
ProcessPromise.prototype.pipe = function(...args) {
const result = _pipe(...args)
return result instanceof ProcessPromise ? result : this
} |
Thanks, I appreciate the reply. Let me better articulate where I think the issue lies here: previously, I was doing the following: const lines = await $(options)`command`.pipe(process.stdout).lines(); In other words, taking advantage of the fact that any method defined for ProcessPromise would return itself, allowing for the above chaining. I've since updated the above to something like so: const cli = $(options)`command`;
cli.pipe(process.stdout);
const lines = await cli.lines(); But you can see how anyone consuming the library and relying on the previous method signature to chain methods like that would be caught off guard by 8.2; hence why I agree with @hfhchan-plb that this maybe should have been a major version change. |
Previously in 8.1.9, calling
.pipe(process.stdout)
would return ProcessPromise, now (8.2.2) it returnsD & PromiseLike<D>
. Is there any way to get the old behaviour?The text was updated successfully, but these errors were encountered: