From e7672ebf46d5d8ce538e25c9a182265dfaf866bf Mon Sep 17 00:00:00 2001 From: anders_k Date: Fri, 16 Apr 2010 14:56:30 +0000 Subject: [PATCH] Return exit code from child process git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6059 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/SubStart/substart.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Contrib/SubStart/substart.c b/Contrib/SubStart/substart.c index becf4333..6238b5a7 100644 --- a/Contrib/SubStart/substart.c +++ b/Contrib/SubStart/substart.c @@ -80,14 +80,17 @@ int main( int argc, char *argv[] ) ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - /* Start a subprocess running the executable of the - sub folder of the cuand wait for its completion */ + /* Start and wait for a process with the same filename as + ourself located in SUBFOLDER. + + WARNING: The subprocess can't parse GetCommandLine() + to find its own path since we pass the wrong path! */ if ( CreateProcess( szPath, GetCommandLine(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) ) { WaitForSingleObject( pi.hProcess, INFINITE ); + GetExitCodeProcess( pi.hProcess, &err ); CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }