Skip to content
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

exit with exit code 1 without printing anything #1365

Open
xlc opened this issue Nov 29, 2023 · 5 comments
Open

exit with exit code 1 without printing anything #1365

xlc opened this issue Nov 29, 2023 · 5 comments

Comments

@xlc
Copy link

xlc commented Nov 29, 2023

I just upgraded all of the deps of my project and precommit hook stops working.

yarn lint-staged will exit with exit code 1 without printing anything

I changed my precommit hook from yarn lint-staged to yarn lint-staged --debug and it works again, which bunch debug info printed.

The root cause is likely coming from eslint or something else. But still, I don't expect lint-staged to exit with an error without printing anything. The the fact that add --debug resolves it properbly means it is lint-staged issue.

Using 15.1.0

here is the logs (that works)

[COMPLETED] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 2 files
[STARTED] *.{js,ts} — 1 file
[STARTED] *.{js,ts,md} — 1 file
[STARTED] eslint --cache --fix
[STARTED] prettier --write
[COMPLETED] prettier --write
[COMPLETED] *.{js,ts,md} — 1 file
[COMPLETED] eslint --cache --fix
[COMPLETED] *.{js,ts} — 1 file
[COMPLETED] package.json — 2 files
[COMPLETED] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
  lint-staged:GitWorkflow Adding task modifications to index... +872ms
  lint-staged:execGit Running git command [
  'add',
  '--',
  '/Users/xiliangchen/projects/acala/node-cdk/lib/config.ts'
] +878ms
  lint-staged:GitWorkflow Done adding task modifications to index! +4ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '-z', '--diff-filter=ACMR', '--staged' ] +4ms
[COMPLETED] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +5ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +5ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', '0' ] +8ms
  lint-staged:GitWorkflow Done dropping backup stash! +13ms
[COMPLETED] Cleaning up temporary files...
  lint-staged Tasks were executed successfully! +958ms
@WhiteCat6142
Copy link

I saw the same phenomenon.
Adding --debug seems to solve the errors.
That's strange.

@WhiteCat6142
Copy link

P.S.
15.0.0 -> correct
15.1.0 -> segmentation fault
15.2.0 -> segmentation fault

@iiroj
Copy link
Member

iiroj commented Feb 18, 2024

The debug mode uses a different Listr2 renderer as seen here:

export const getRenderer = (options, logger, env = process.env) => {
const mainRendererOptions = getMainRendererOptions(options, logger, env)
return {
...mainRendererOptions,
fallbackRenderer: getFallbackRenderer(mainRendererOptions, env),
}
}

Does it work with --quiet or TERM=dumb flags? If so, that would also imply it's something to do with the default renderer.

@WhiteCat6142
Copy link

WhiteCat6142 commented Feb 19, 2024

With —quiet and TERM=dumb, it works at 15.2.0.

@maxime-bc
Copy link

maxime-bc commented Apr 8, 2024

Hello,

I came to the same conclusion before coming across this issue because I was searching for one mentioning SIGSEGV, without success.

I had the same issue. By default, my TERM environment variable value is xterm-256color, and running lint-staged 15.2.2 exits with code 1, and the following message is displayed: error Command failed with signal "SIGSEGV". It also makes my terminal cursor disappear. I have to run tput cnorm to make it reappear.

Adding --debug, or --quiet, or exporting TERM=dumb solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants