.sh-file execution with PHPStorm (Pre Commit Hook in Windows)
I want to use the pre-commit-hook plugin in PHPstorm to use phptidy on my code before comiting.
The pre-commit-hook.sh file is located in the project folder and recognized by the plugin.
I set the file association in Windows, so when I double click the file, the script is executed as intended.
However, whenever I try to commit, I get the following error:
Exception while running pre-commit hook : Cannot run program "D:/project/pre-commit-hook.sh" (in directory "D:\project\"): CreateProcess error=193, %1 is not a valid Win32 application
Would you like to commit?
Is there anything I can do to make it work?
As I said, I can execute the file manually and the association is set. It seems that it's PHPstorm that has an issue.When I right-click on the file in PHPstorm, I can run it without issues using the context menu command.
Would appreciate any help.
Please sign in to leave a comment.
edit:
It should say '(in directory "D:\project\")'
Another addition:
When I right-click on the file in PHPstorm, I can run it without issues using the context menu command.
Have you tried to use a "pre-commit-hook.bat" file ?
just did. The pre-commit-hook plugin seems to specifically search for .sh
Seems fix wasn't included in build: https://github.com/yahely/PreCommitHookPlugin/issues/10
Thanks for the response Yaroslav. I guess I can't use it then.
You may contact plugin vendor and ask them to privide a fix.