force-exit-zero
v0.1.0
Published
Force a command to exit with code 0 (success), regardless of the result. Perfect for CI pipelines.
Downloads
2
Maintainers
Readme
force-exit-zero
Force a command to exit with code 0 (success).
The Problem: Your CI fails because a linter found a warning, or a non-critical script returned exit code 1. You try adding || true but it doesn't work consistently across Windows/Linux shells.
The Solution: force-exit-zero runs your command, streams the output (colors preserved), and always reports success to the OS.
Install
npm install force-exit-zeroUsage
In package.json scripts
{
"scripts": {
"lint": "eslint .",
"lint:ci": "force-exit-zero npm run lint"
}
}In GitHub Actions / CI
steps:
- run: npx force-exit-zero npm run test:flakyCLI
$ force-exit-zero ls --unknown-flag
ls: unrecognized option '--unknown-flag'
# (The command failed, but the process exited with 0)Why not || true?
|| truedoesn't work in standard Windows cmd.exe.|| truecan be confusing in complexnpm runchains.force-exit-zerois explicit: you are intentionally suppressing the failure.
License
MIT
{ github.com/mgks }
![]()
