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

"The command line is too long." issue on Windows #41

Closed
ivancuric opened this issue Aug 2, 2019 · 8 comments
Closed

"The command line is too long." issue on Windows #41

ivancuric opened this issue Aug 2, 2019 · 8 comments
Labels
bug Something isn't working Windows Windows case

Comments

@ivancuric
Copy link

Running a script like

    react-templates:
      glob: '*.{jsx,tsx}'
      run: >
        npx eslint {staged_files} --fix &&
        npx prettier {staged_files} --write &&
        git add {staged_files}

when there are lots of files throws the The command line is too long on Windows. Haven't had this issue with husky

@Arkweid Arkweid added bug Something isn't working Windows Windows case labels Aug 4, 2019
@Arkweid
Copy link
Collaborator

Arkweid commented Aug 4, 2019

@ivancuric thank you for issue! How much files you try to commit?

@ivancuric
Copy link
Author

ivancuric commented Aug 4, 2019

a lot :D It was a find+replace project wide for multiple issues.

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 4, 2019

Can you split commands in way like this without parallel option?

1_react-templates-eslint:
      glob: '*.{jsx,tsx}'
      run: npx eslint {staged_files} --fix
2_react-templates-prettier:
      glob: '*.{jsx,tsx}'
      run: npx prettier {staged_files} --write
3_react-templates-add:
      glob: '*.{jsx,tsx}'
      run: git add {staged_files}

Looks like Windows can't process a large command.

@ivancuric
Copy link
Author

Guess I could. Husky did it quite nicer to be honest, with an array of commands.
Using .yaml and && feels quite messy by comparison.

@Arkweid
Copy link
Collaborator

Arkweid commented Aug 4, 2019

Is it also happens if you run it under Windows SubSystem for Linux?

Using .yaml and && feels quite messy by comparison.

For run option we want to have the same "natural" syntax as you see in your terminal. So that the user always understands exactly what is happening without any hidden processes. It's our tradeoff :)

@vkrol
Copy link

vkrol commented May 14, 2020

FYI: It was fixed in lint-staged via chunking lint-staged/lint-staged#732. In theory, the same solution can be used in Lefthook.

@pvds
Copy link

pvds commented Sep 17, 2023

@mrexox this issue can be closed since it's fixed by #541

@mrexox
Copy link
Member

mrexox commented Sep 18, 2023

Right, thank you! Closing it. Must be fixed with version 1.4.10

@mrexox mrexox closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Windows case
Projects
None yet
Development

No branches or pull requests

5 participants