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?