https://github.com/mgks/force-exit-zero
Force a command to exit with code 0 (success), regardless of the result. Perfect for CI pipelines.
https://github.com/mgks/force-exit-zero
automation ci error-handling failsafe nodejs
Last synced: 4 months ago
JSON representation
Force a command to exit with code 0 (success), regardless of the result. Perfect for CI pipelines.
- Host: GitHub
- URL: https://github.com/mgks/force-exit-zero
- Owner: mgks
- License: mit
- Created: 2025-12-27T22:58:58.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-12-28T00:11:33.000Z (5 months ago)
- Last Synced: 2025-12-30T02:30:38.155Z (5 months ago)
- Topics: automation, ci, error-handling, failsafe, nodejs
- Language: JavaScript
- Homepage:
- Size: 215 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# force-exit-zero
**Force a command to exit with code 0 (success).**
Sometimes CI fails for the pettiest reasons, a linter warning or a non-critical script exiting with code 1. Shell hacks like `||` true are unreliable across Windows and Unix, so `force-exit-zero` runs your command, streams the output with colours intact, and always reports success back to the OS, no matter what the command does.
## Installation
```bash
npm install force-exit-zero
```
## Usage
### In `package.json` scripts
```json
{
"scripts": {
"lint": "eslint .",
"lint:ci": "force-exit-zero npm run lint"
}
}
```
### In GitHub Actions / CI
```yaml
steps:
- run: npx force-exit-zero npm run test:flaky
```
### CLI
```bash
$ force-exit-zero ls --unknown-flag
ls: unrecognized option '--unknown-flag'
# (The command failed, but the process exited with 0)
```
## Why not `|| true`?
* `|| true` doesn't work in standard Windows cmd.exe.
* `|| true` can be confusing in complex `npm run` chains.
* `force-exit-zero` is explicit: you are intentionally suppressing the failure.
## License
MIT
> **{ github.com/mgks }**
>
>  