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

Chunks tasks can't load csx files in parallel. #93

Closed
alirezanet opened this issue Sep 18, 2023 Discussed in #92 · 2 comments
Closed

Chunks tasks can't load csx files in parallel. #93

alirezanet opened this issue Sep 18, 2023 Discussed in #92 · 2 comments
Labels
bug Something isn't working fixed

Comments

@alirezanet
Copy link
Owner

Discussed in #92

Originally posted by AlaiyaNetwork September 18, 2023
Hi all, I encountered a few errors when using pre-commit hook with a large number of files in a commit.

1 error:
fatal: Unable to create 'C:/WorkDirectory/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.

2 error:
The process cannot access the file 'C:\WorkDirectory\.husky\csx\add-header-to-main.csx' because it is being used by another process.

The first error also occurs when using prettier, not only with custom scripts. But it doesn't cause the script to abort
[Husky] ⚡ Preparing task 'Run prettier'
[Husky] ⚠️ The Maximum argument length '8191' reached, splitting matched files into 16 chunks
[Husky] ⌛ Executing task 'Run prettier' ...
fatal: Unable to create 'C:/WorkDirectory/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.
[Husky] ✔ Successfully executed in 2 304ms

This is my custom script:
[Husky] ⚡ Preparing task 'Run add header to main script'
[Husky] ⚠️ The Maximum argument length '8191' reached, splitting matched files into 9 chunks
[Husky] ⌛ Executing task 'Run add header to main script' ...
The process cannot access the file 'C:\WorkDirectory\.husky\csx\add-header-to-main.csx' because it is being used by another process.
The process cannot access the file 'C:\WorkDirectory\.husky\csx\add-header-to-main.csx' because it is being used by another process.
The process cannot access the file 'C:\WorkDirectory\.husky\csx\add-header-to-main.csx' because it is being used by another process.
The process cannot access the file 'C:\WorkDirectory\.husky\csx\add-header-to-main.csx' because it is being used by another process.
fatal: Unable to create 'C:/WorkDirectory/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.
❌ Task 'Run add header to main script' failed in 487ms
husky - pre-commit hook exited with code 1 (error)

Prettier task:
{ "name": "Run prettier", "command": "npx", "cwd": "Paylater.BackOffice.ReactApp", "args": [ "prettier", "--plugin", "prettier-plugin-organize-imports", "--ignore-unknown", "--write", "${staged}" ], "pathMode": "absolute" }

Maybe someone has encountered a similar problem and can give me a solution.

@alirezanet alirezanet added the bug Something isn't working label Sep 18, 2023
@AlaiyaNetwork
Copy link

I created test repo - https:/AlaiyaNetwork/TestHuskyChunksError

This is funny console project create a lot of .cs files.

Husky have 3 tasks:

  • echo staged files
  • run csharpier
  • run csx script

@alirezanet
Copy link
Owner Author

Hi @AlaiyaNetwork,
Please try version v0.6.2, it should be fixed and let me know if you encountered any problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants