Skip to content

Fix errors being thrown when detached: true or cleanup: false is used#360

Merged
sindresorhus merged 5 commits intomasterfrom
bug/cleanup-detached-errors
Aug 14, 2019
Merged

Fix errors being thrown when detached: true or cleanup: false is used#360
sindresorhus merged 5 commits intomasterfrom
bug/cleanup-detached-errors

Conversation

@ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Aug 9, 2019

Using either the detached: true and cleanup: false always throws an error:

> await execa('echo',{cleanup: false})
Thrown:
TypeError: Cannot destructure property `error` of 'undefined' or 'null'.
    at handlePromise (/home/ether/code/execa/index.js:107:10)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
> await execa('echo',{detached: true})
Thrown:
TypeError: Cannot destructure property `error` of 'undefined' or 'null'.
    at handlePromise (/home/ether/code/execa/index.js:107:10)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)

This was introduced by one my PRs here.

This is a quite critical bug, we should release this. However the current code contains breaking changes: users of the all property must now use the all: true option. So this would be a major release.

Additionally some tests that check t.throwsAsync() were incorrect but previously successful due to that bug being present (since it made execa fail but for the wrong reason). I have fixed those tests (mostly Windows issues).

@ehmicky ehmicky force-pushed the bug/cleanup-detached-errors branch from 845e75f to 69a8550 Compare August 9, 2019 10:11
@sindresorhus
Copy link
Owner

This is a quite critical bug, we should release this. However the current code contains breaking changes: users of the all property must now use the all: true option. So this would be a major release.

I don't think we should release the all change yet. I would prefer to resolve #351 first. What we could do is to create a branch based on v2.0.3, apply the one-line fix, and do a v2.0.4 release to an alternative dist-tag. ?

@sindresorhus sindresorhus merged commit c3526cd into master Aug 14, 2019
@sindresorhus sindresorhus deleted the bug/cleanup-detached-errors branch August 14, 2019 11:26
@ehmicky
Copy link
Collaborator Author

ehmicky commented Aug 15, 2019

Would the following be simpler?

sindresorhus pushed a commit that referenced this pull request Aug 15, 2019
@sindresorhus
Copy link
Owner

I prefer doing it from a branch. That way the main commit history doesn't get the revert noise.

Done: https://github.com/sindresorhus/execa/releases/tag/v2.0.4


and do a v2.0.4 release to an alternative dist-tag. ?

Scratch the alternative dist-tag part. That was wrong.

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