Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

suppress-exit-code

kachkaev28.1kMIT3.2.0

Cross-platform CLI wrapper that runs any command and exits with zero

cli, exit-code, ignore, suppress

readme

suppress-exit-code

Cross-platform CLI wrapper that runs any command and exits with zero

npm

## exits with non-zero
crazy-broken-command --some-arg=42

## exits with zero, stdout and stderr streams are kept as is
suppress-exit-code crazy-broken-command --some-arg=42

Motivation: https://github.com/okonet/lint-staged/issues/616

Installation

Local

npm install --dev suppress-exit-code
## or
yarn add --dev suppress-exit-code
## or
pnpm add --dev suppress-exit-code

Global

npm install --global suppress-exit-code
## or
yarn global add suppress-exit-code
## or
pnpm add --global suppress-exit-code

Possible improvements

Feel free to contribute with a PR if you need these extra features (they are possible, but are not implemented yet):

## keep exit code unless it matches a given whitelist
suppress-exit-code --only=1,2,3 crazy-broken-command --some-arg=42
## make sure nothing is ever printed to the standard error stream
## (helps when running a subcommand in sensible environments)
suppress-exit-code --stderr=pipe-to-stdout crazy-broken-command --some-arg=42
suppress-exit-code --stderr=suppress crazy-broken-command --some-arg=42

changelog

v3.2.0 (2023-06-26)

v3.1.0 (2022-10-19)

  • Support global install

    npm install --global suppress-exit-code
    ## or
    yarn global add suppress-exit-code
    ## or
    pnpm add --global suppress-exit-code

v3.0.0 (2022-10-19)

  • [breaking] Drop Node 12 support

  • [potentially breaking] Switch to ESM (#5, context)

v2.0.1 (2022-10-18)

  • Remove .yarn/sdks from published package

  • Fix CHANGELOG.md

v2.0.0 (2022-10-18)

  • [potentially breaking] Use stdio: "inherit" instead of piping stdout and stderr (#3)

  • Chores:

    • Update CI config and tests
    • Update devDependencies
    • Configure husky and lint-staged

v1.0.0 (2020-12-20)

  • Upgrade execa from v1 to v5

  • Add tests

  • Switch to Yarn Berry – this only affects the dev process and does not impact end users (#1)

  • [breaking] Replace console.log with console.error when no args are provided (885f28eb)