vercel/turborepo
notifyUpdate() exits with code 0 on error, masking failures in @turbo/gen CLI
Summary
Context: The
@turbo/genCLI is a command-line tool for extending Turborepo projects by running generators and creating workspaces.Bug: When an error occurs during CLI execution, the
notifyUpdate()function callsprocess.exit()without an exit code argument, causing the process to exit with code 0 (success) instead of the intended code 1 (error).Actual vs. expected: The CLI exits with code 0 (success) after encountering an error, when it should exit with code 1 (error).
Impact: CI/CD pipelines, shell scripts, and automation tools that rely on exit codes will incorrectly interpret failed CLI executions as successful, potentially masking errors and causing downstream issues.
Code with bug
Location: packages/turbo-gen/src/utils/notifyUpdate.ts
Error handler in: packages/turbo-gen/src/cli.ts
Example
Repro steps and resulting behavior:
Run:
turbo-gen run --config /nonexistent/config.jsCLI throws
GeneratorError: “No config at ‘/nonexistent/config.js’” and enters the catch handler, which logs the error and awaitsnotifyUpdate().notifyUpdate()callsprocess.exit()without an argument; no update is available, so it exits immediately with code 0.The intended
process.exit(1)in the catch handler is never reached.
Expected exit code: 1 Actual exit code: 0
Recommended fix
Copy directly from the original exploration:
packages/turbo-gen/src/utils/notifyUpdate.ts:
packages/turbo-gen/src/cli.ts:
