Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don’t call
release
with an exit code (#6981)
* Don’t call `release` with an exit code The `release` signature is incorrect, because its first argument is a callback function that will be called when the release is done. By attaching it to the `run()` promise however, release will be called with the exit code as argument. When the exit code is `1`, the code will crash. This is very rare, but we’re seeing this when calling yarn from another node process (and possibly killing it too soon): ``` <redacted>/node_modules/yarn/lib/cli.js:78119 callback(); ^ TypeError: callback is not a function at options.fs.rmdir (<redacted>/node_modules/yarn/lib/cli.js:78119:9) at FSReqWrap.oncomplete (fs.js:141:20) ``` * Only resolve after releasing is done, improve type of `release`. Note that this slightly violates the type of runEventuallyWithFile, as the Promised resolved by the release callback might return an Error object. But since this error was also not handled before, it’s out of scope for the fix of this patch.
- Loading branch information