My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1406: Hooks are unusable under Windows
4 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by org...@gmail.com, May 23, 2012
Gerrit tries to run hooks as system executable. While this works under linux, Windows doesn't allow running bat files (or shell scripts) without extension.

error_log:
[2012-05-23 13:18:21,223] ERROR com.google.gerrit.common.ChangeHookRunner : Error running hook C:\Projects\gerrit\hooks\change-restored
java.io.IOException: Cannot run program "C:\Projects\gerrit\hooks\change-restored" (in directory "C:\Projects\gerrit\git\Project.git"): CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessBuilder.start(Unknown Source)
	at com.google.gerrit.common.ChangeHookRunner$HookTask.run(ChangeHookRunner.java:499)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:333)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 11 more

Jun 4, 2012
Project Member #1 choro...@wikimedia.org
Can this be worked around by adding an extension then changing gerrit.config's [hooks] section to point to the new name?
Jun 4, 2012
#2 org...@gmail.com
It can. I use a batch file and it works.
Sep 20, 2012
#3 wer...@beroux.com
Like Tortoise, it should probably look for *.exe, *.bat, *.cmd.
Oct 27, 2014
#5 madhusud...@gmail.com
[hooks]
  changeRestored = change-restored.bat
Sign in to add a comment

Powered by Google Project Hosting