R2Build is installed on the build machine. The task is to launch it automatically when the trigger is triggered. For these purposes, a separate mini-program is written. R2Build can be launched for execution using the command line:

R2build.exe -r -q D:\FileName.r2p 

When you run this command via CMD, everything works. When a command is launched from code, the following happens: R2Build starts and starts working, but at the stage of working with SVN it gives an error, without explaining the reasons.

 HANDLE hChildStdoutRead; HANDLE hChildStdoutWrite; BOOL fSuccess; SECURITY_ATTRIBUTES saAttribute = { sizeof(SECURITY_ATTRIBUTES) }; saAttribute.bInheritHandle = TRUE; saAttribute.lpSecurityDescriptor = NULL; if (!CreatePipe(&hChildStdoutRead, &hChildStdoutWrite, &saAttribute, 0)) { return strResult; } STARTUPINFO sInfo = { sizeof(STARTUPINFO) }; sInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; if (fNeedResult) { sInfo.hStdOutput = hChildStdoutWrite; sInfo.hStdError = hChildStdoutWrite; } sInfo.wShowWindow = SW_HIDE; PROCESS_INFORMATION pInfo = { 0 }; fSuccess = CreateProcess(NULL, szCommand, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sInfo, &pInfo); 

The mini-program runs as administrator:

 <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> 

Windows Server 2012 R2 is installed on the build machine.

What could be the problem? How can I execute a command from code so that it is equivalent to executing a command in a CMD?

  • And what error does SVN produce? - VladD
  • And what prevents to launch CMD in a new process? - Nikola Tesla
  • Concerning SVN error. There is no error (empty in the logs). I suppose that this is some kind of failure of R2Build itself. The project is abandoned, so it's useless to contact the developers. - g0liath
  • About the new process. I tried various options. In the last attempt, I placed the command in the BAT file and, through the same CreateProcess, launched this file. The result is the same (an error at the SVN stage). In this case, by double clicking on the BAT file, everything works fine. - g0liath
  • And the launcher is going as a console application? - tonal

0