Ich habe eine Methode gefunden, um meine Frage zu lösen, kompilieren Sie den folgenden c-Code und benannte die exe-Ausgabe als runjob.exe, und dann in der hook bat-Datei, verwenden Sie "runjob another_prog", jetzt ist es in Ordnung.
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
int _tmain()
{
char * pCmd = ::GetCommandLine();
// skip the executable
if (*pCmd++ == L'"')
{
while (*pCmd++ != L'"');
}
else
{
while (*pCmd != NULL && *pCmd != L' ')
++pCmd;
}
while (*pCmd == L' ')
pCmd++;
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
// Start the child process.
BOOL result = CreateProcess
(
NULL, // No module name (use command line)
pCmd, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set bInheritHandles to FALSE
DETACHED_PROCESS, // Detach process
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure (returned)
);
if (result) return 0;
char msg[2048];
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
::GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
msg, sizeof(msg),
NULL
);
fputs(msg, stderr);
_flushall();
return -1;
}
Können Sie klären, welches Problem du lösen willst? Ist es wirklich so, dass der Subversion-Post-Commit-Hook darauf wartet, dass alle Prozesse beendet werden? Warum funktioniert 'cmd/c startWebLogic.cmd' nicht? – Cheeso
Start cmd/c funktioniert nicht, da der SVN-Post-Commit-Hook auf den Hook und den ** child ** -Prozess wartet, der vom Hook-Exit erstellt wurde. Es ist das Design von SVN. Ich habe eine Lösung gefunden, siehe: http://svn.haxx.se/users/archive-2008-11/0301.shtml – zhongshu