开发者

SVN post-commit works only manually

HI,

I've created a batch file called post-commit.bat and placed it under the /hooks directory.

The content of the file is:

TestCS.exe

The content of the exe file is:

static void Main(string[] args)
    {

        try
        {
            // create a writer and open the file
            TextWriter tw = new StreamWriter("date.txt");

            // write a line of text to the file
            tw.WriteLine(DateTime.Now);

            // close the stream
            tw.Close();
        }
        catch { }
    }

When I double-click on post-commit.bat, it creates the date.txt file.

When I commit in SVN, it takes time, and eventually gi开发者_运维问答ves me the following message: alt text http://img688.imageshack.us/img688/3894/exception.jpg

What can be the problem?

Thanks!


The obvious thing to do would be to launch the debugger and get a better idea of where the problem is occurring.

I would suggest that you should use a using statement for your TextWriter, and avoid catching and swallowing all exceptions without any attempt to even log the error.

Is that really your whole code? You're not using args at all? It's hard to see how that code would lead to an IndexOutOfRangeException...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜