diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-18 20:15:33 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-19 12:07:32 -0500 |
commit | fb54576f1d05e82ba47cd718c4c4f8b3bad624c9 (patch) | |
tree | b7d6b30bd3c9294b74874c1a48b20a8da8869a69 /src/burn/engine/bundlepackageengine.cpp | |
parent | 581c320e04949300d6c3bee71fb5fc1a557f9263 (diff) | |
download | wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.tar.gz wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.tar.bz2 wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.zip |
Give BA process id and option to wait for cancelled process to exit.
Diffstat (limited to 'src/burn/engine/bundlepackageengine.cpp')
-rw-r--r-- | src/burn/engine/bundlepackageengine.cpp | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/burn/engine/bundlepackageengine.cpp b/src/burn/engine/bundlepackageengine.cpp index 88a00f5e..0bee054f 100644 --- a/src/burn/engine/bundlepackageengine.cpp +++ b/src/burn/engine/bundlepackageengine.cpp | |||
@@ -251,7 +251,6 @@ extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( | |||
251 | ) | 251 | ) |
252 | { | 252 | { |
253 | HRESULT hr = S_OK; | 253 | HRESULT hr = S_OK; |
254 | int nResult = IDNOACTION; | ||
255 | LPCWSTR wzArguments = NULL; | 254 | LPCWSTR wzArguments = NULL; |
256 | LPWSTR sczArguments = NULL; | 255 | LPWSTR sczArguments = NULL; |
257 | LPWSTR sczArgumentsFormatted = NULL; | 256 | LPWSTR sczArgumentsFormatted = NULL; |
@@ -420,31 +419,10 @@ extern "C" HRESULT BundlePackageEngineExecuteRelatedBundle( | |||
420 | hr = EmbeddedRunBundle(sczExecutablePath, sczCommand, pfnGenericMessageHandler, pvContext, &dwExitCode); | 419 | hr = EmbeddedRunBundle(sczExecutablePath, sczCommand, pfnGenericMessageHandler, pvContext, &dwExitCode); |
421 | ExitOnFailure(hr, "Failed to run bundle as embedded from path: %ls", sczExecutablePath); | 420 | ExitOnFailure(hr, "Failed to run bundle as embedded from path: %ls", sczExecutablePath); |
422 | } | 421 | } |
423 | else // create and wait for the executable process while sending fake progress to allow cancel. | 422 | else |
424 | { | 423 | { |
425 | // Make the cache location of the executable the current directory to help those executables | 424 | hr = ExeEngineRunProcess(pfnGenericMessageHandler, pvContext, pPackage, sczExecutablePath, sczCommand, sczCachedDirectory, &dwExitCode); |
426 | // that expect stuff to be relative to them. | 425 | ExitOnFailure(hr, "Failed to run BUNDLE process"); |
427 | si.cb = sizeof(si); | ||
428 | if (!::CreateProcessW(sczExecutablePath, sczCommand, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, sczCachedDirectory, &si, &pi)) | ||
429 | { | ||
430 | ExitWithLastError(hr, "Failed to CreateProcess on path: %ls", sczExecutablePath); | ||
431 | } | ||
432 | |||
433 | do | ||
434 | { | ||
435 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | ||
436 | message.dwUIHint = MB_OKCANCEL; | ||
437 | message.progress.dwPercentage = 50; | ||
438 | nResult = pfnGenericMessageHandler(&message, pvContext); | ||
439 | hr = (IDOK == nResult || IDNOACTION == nResult) ? S_OK : IDCANCEL == nResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE); | ||
440 | ExitOnRootFailure(hr, "Bootstrapper application aborted during BUNDLE progress."); | ||
441 | |||
442 | hr = ProcWaitForCompletion(pi.hProcess, 500, &dwExitCode); | ||
443 | if (HRESULT_FROM_WIN32(WAIT_TIMEOUT) != hr) | ||
444 | { | ||
445 | ExitOnFailure(hr, "Failed to wait for executable to complete: %ls", sczExecutablePath); | ||
446 | } | ||
447 | } while (HRESULT_FROM_WIN32(WAIT_TIMEOUT) == hr); | ||
448 | } | 426 | } |
449 | 427 | ||
450 | hr = ExeEngineHandleExitCode(pPackage->Bundle.rgExitCodes, pPackage->Bundle.cExitCodes, dwExitCode, pRestart); | 428 | hr = ExeEngineHandleExitCode(pPackage->Bundle.rgExitCodes, pPackage->Bundle.cExitCodes, dwExitCode, pRestart); |