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

Hook fails if it contains npm run command #15713

Open
JosefBredereck opened this issue Dec 2, 2022 · 1 comment
Open

Hook fails if it contains npm run command #15713

JosefBredereck opened this issue Dec 2, 2022 · 1 comment

Comments

@JosefBredereck
Copy link

JosefBredereck commented Dec 2, 2022

The problem

I have discovered a new problem when using husky in combination with GitHub Desktop.

When committing any file and I have a pre-commit hook that includes any npm run script, it fails with the following message:

.husky/pre-commit: line 4:  1527 Segmentation fault npm run test-cmd 
husky - pre-commit hook exited with code 139 (error)

Because there is no more Data in the logs, I cannot find why that is.

If I just have echo "hello" in my pre-commit hook, it succeeds as expected.

Release version

Version 3.1.2 (x64)

Operating system

Windows 10

Steps to reproduce the behavior

  1. npm install husky -D
  2. npm pkg set scripts.prepare="husky install"
  3. npm run prepare
  4. npm pkg set scripts.test-cmd="echo 'hello'"
  5. npx husky add .husky/pre-commit "npm test"

Log files

2022-12-02T16:55:07.684Z - info: [ui] Executing createCommit: git commit -F - (took 2.893s)
2022-12-02T16:55:07.687Z - error: [ui] git commit -F - exited with an unexpected code: 1.
stderr:
.husky/pre-commit: line 4: 290 Segmentation fault npm run test-cmd
husky - pre-commit hook exited with code 139 (error)

2022-12-02T16:55:07.688Z - info: [ui] [Timing] Action 'create commit' for 'test-commit' took 3.139s

Screenshots

No response

Additional context

No response

@JosefBredereck JosefBredereck changed the title Hook if it contains npm run command Hook fails if it contains npm run command Dec 2, 2022
@AnilBairi
Copy link

This might be similar to conventional-changelog/commitlint#3485

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

No branches or pull requests

2 participants