-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
onSuccess & Watch Fix #1253
base: main
Are you sure you want to change the base?
onSuccess & Watch Fix #1253
Conversation
…Watch commands would not trigger if an onSuccess command was provided.
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
- await onSuccessProcess
- if (
- onSuccessProcess.exitCode &&
- onSuccessProcess.exitCode !== 0
- ) {
- process.exitCode = onSuccessProcess.exitCode
- }
+ onSuccessProcess.process?.on('exit', (code) => {
+ if (code && code !== 0) {
+ process.exitCode = code
+ }
+ }) In stead of only removing the await we should probably reflect the behaviour it had before it broke. |
I'd agree: unfortunately, it appears the previous commit wasn't quite as interested in doing the same: 4dd5bfe#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80 Note that the await statement was added. By removing it, we're getting closer to the original intention. Unfortunately, tinyexec does not appear to be using standard promises. When I attempted to add If we're to go back to previous functionality, we should probably move back to |
when we do not await we will not capture the exit code ever. The |
And when we do await, we completely break use of |
@laat I've revised the code in this PR to now show errors on save, while also retaining the onSuccess function and watch function. I tested this in another project of mine where 8.3.5 did not function correctly. Watching/onSuccess worked as intended and errors were shown in the CLI. |
We should probably not produce promises that we do not catch or await (by way of a async processExitHandler), as this will very often lead to This is the proper fix #1256 |
The problem is that |
the processExitHandler result is a real promise. tinyexec is promiselike |
if |
I've addressed this, read my comment again. |
fixes #1245
Removed an await line for tinyexec-based binary executation command.
Watch commands would not trigger if an onSuccess command was provided.