From 150a8d388ca879ea71aaf532bec43037bf020ce7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 25 Jan 2016 15:37:11 -0800 Subject: [PATCH] allow user to close running exec and continue --- cmake/templates/NSIS.template.in | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 09aa92ed47..801b773844 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -682,14 +682,25 @@ FunctionEnd !include nsProcess.nsh !macro PromptForRunningApplication applicationName displayName action prompter - ${nsProcess::FindProcess} ${applicationName} $R0 + !define UniqueID ${__LINE__} - ${If} $R0 == 0 - ; the process is running, ask the user if they want us to close it - MessageBox MB_OK|MB_ICONEXCLAMATION \ - "${displayName} cannot be ${action} while ${displayName} is running.$\r$\nPlease close it and try again." - Abort - ${EndIf} + Prompt_${UniqueID}: + + ${nsProcess::FindProcess} ${applicationName} $R0 + + ${If} $R0 == 0 + + ; the process is running, ask the user to close it + MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION \ + "${displayName} cannot be ${action} while ${displayName} is running.$\r$\nPlease close it to continue." \ + /SD IDCANCEL IDRETRY Prompt_${UniqueID} IDCANCEL 0 + + ; If the user decided to cancel, stop the current installer/uninstaller + Abort + + ${EndIf} + + !undef UniqueID !macroend !macro CheckForRunningApplications action prompter