Process to export svn files hangs with Process.Start()


I try to execute a .cmd to export files from SVN, it works manually and in my local machine(WS2003 SP2 IIS Identiy: Local System), but it fails in the execution server (same configuration).

The script I execute is:

echo.%Date%-%Time%- Username %username%>>c:\vpcheckcode\logsvn.txt

svn export %svnUrl% %srcFolder% --force --username %usr% --password %psw%

If I try simply to copy a file, no svn, it works.

When I execute it manually it logs my user and it exports the files. On develop PC it doesn't log the user but it works, in execution server it doesn't log the user and it doesn't works.

I try to execute the .cmd in this way:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.FileName = strFileName;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;

startInfo.Arguments = svnUrl + " " + srcFolder+ " " + usr+" "+psw;

using (Process exeProcess = Process.Start(startInfo))
    pid = exeProcess.Id;
    EventLog.WriteEntry("VPCheckCodeSrvDll.ExecuteScriptSVN", "avviato pid svn: " + pid.ToString(), EventLogEntryType.Warning);

    if (!exeProcess.WaitForExit((int)_svnExportTimeout))

The process hangs untill it has been killed.

C:\Documents and Settings\myuser>tlist 4980
4980 cmd.exe
   CWD:     c:\windows\system32\inetsrv\
   CmdLine: cmd /c ""C:\ANALISI\000000-xx-v90\SVN\svnExport.cmd"    https://svn.mysite.local/repos/HA/branches/H
   VirtualSize:    11332 KB   PeakVirtualSize:    15492 KB
   WorkingSetSize:  1832 KB   PeakWorkingSetSize:  1848 KB
   NumberOfThreads: 1
   2704 Win32StartAddr:0x4ad07670 LastErr:0x000000cb State:Waiting
  5.2.3790.3959 shp  0x4AD00000  cmd.exe
  5.2.3790.4937 shp  0x7C800000  ntdll.dll
  5.2.3790.5069 shp  0x77E40000  kernel32.dll
  7.0.3790.3959 shp  0x77BA0000  msvcrt.dll
  5.2.3790.4455 shp  0x7D1E0000  ADVAPI32.dll
  5.2.3790.4759 shp  0x77C50000  RPCRT4.dll
  5.2.3790.4455 shp  0x76F50000  Secur32.dll
  5.2.3790.4033 shp  0x77380000  USER32.dll
  5.2.3790.4396 shp  0x77C00000  GDI32.dll
  5.2.3790.3959 shp  0x71BD0000  MPR.dll
  5.2.3790.3959 shp  0x76290000  IMM32.DLL

Any suggestion?

asked on Stack Overflow Apr 16, 2013 by Duccio Fabbri

1 Answer


I did something similar. Try the following:

Change : startInfo.Arguments = svnUrl + " " + srcFolder+ " " + usr+" "+psw;

to : startInfo.Arguments = String.Format("{0} \"{1}\" --username {2} --password {3}", svnUrl, srcFolder, usr, psw);

I am making the assumption that your usr and psw variables do not contain the parameter information for subversion. Also, my destination included the file name (I can't see your full command line as it is cut off) and also contained spaces, so I had to enclose it within quotes. Your svnUrl should have "%20" in place of spaces if you have any (again, the full URL is not visible).

answered on Stack Overflow Apr 29, 2013 by Rod

User contributions licensed under CC BY-SA 3.0