5
votes

I have created an exe file that will print to console the first and second arguments that it receives.

In the SVN post-commit hook I wrote:

PATH_TO_FILE\print.exe "%1" "%2"

when I make a check-in, it gets stuck.

%1 is the PATH
%2 is revision number

EDIT

The answer to my question is that the executable file should be in the "bin" directory of the SVN Server, not in the hooks folder of the repository.

Thank you all, Oded.

3
@Oded: you added a lot of extra details in the comments to the answers. You can make the question clearer & better by editing it to add the details.JXG

3 Answers

1
votes

Print takes a filename to put on the printer. You are supplying a directory i assume of your description. Try writing something to a file.

echo "%1" "%2" > c:\temp\log.txt
0
votes

What OS are we talking about? If it's Windows I don't think you should have the quotes (") around the parameters.

What is "PATH_TO_FILE"? And environment variable? What is it's value? Have you checked that it doesn't include a final backslash? Have you restarted after changing the environment variable. Is it a system wide or user level environment variable. Remember that if you are running the SVN server as a service it's under a different user so the env var might not be defined for that user. Why don't you just put the full path in directly for now just to test it's nothing to do with an incorrect environment variable.

You say "it gets stuck" do you get an error? What happens exactly? Some more details of how it fails might help.

If this is Windows you are using, you can redirect any errors to a file by doing this:

PATH_TO_FILE\print.exe %1 %2 > c:\output.txt

Is this a plain SVN server or are you using visualSVN Server?

0
votes

It must be Windows environment since I see print.exe. I simply echo the arguments like below.

echo %1 %2 >&2

This seems to print to the command prompt without issues.