Skip to content
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

Running the postinstall hook twice is surprising and unexpected, especially with suppressed output #16

Open
chetstone opened this issue Dec 11, 2021 · 0 comments

Comments

@chetstone
Copy link

As noted in the README, this package runs the postinstall hook twice when yarn is run on your project.
The first time it is run, apparently standard out and standard in are swallowed. This is no doubt done to prevent confusion on the part of users of patch-package, so they don't see reports of their patches being run twice.

However, I needed to add another script to my postinstall hook cause I needed to do patching in a different way than patch-package does. My script happened to be idempotent, but I spent hours tearing my hair out because it was reporting that my patch had already been applied. How could the script be getting run twice? But it couldn't be getting run twice because if it were, it would be reporting both runs on the console, WOULDN'T IT???????

Finally I got to the README in this package. I had read the README of patch-package, but hadn't bothered coming here.

I suggest that, if a better way cannot be found to convince yarn to run the postinstall hook on yarn remove, that a note warning of this behavior should be added to the Why use postinstall-postinstall section of the patch-package README.

Also, add a note to the fact that standard out and standard error are suppressed to this README.

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

No branches or pull requests

1 participant