Ensure the app is closed before installing on Windows
This commit is contained in:
parent
bcaca1ebd5
commit
d1d53b645d
3 changed files with 66 additions and 5 deletions
2
.github/workflows/benchmark.yml
vendored
2
.github/workflows/benchmark.yml
vendored
|
@ -40,7 +40,7 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock', 'patches/**') }}
|
||||
|
||||
- name: Install Desktop node_modules
|
||||
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
|
||||
|
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock', 'patches/**') }}
|
||||
- name: Install Desktop node_modules
|
||||
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
|
@ -51,7 +51,7 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock', 'patches/**') }}
|
||||
- name: Install Desktop node_modules
|
||||
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
|
@ -84,7 +84,7 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock', 'patches/**') }}
|
||||
- name: Install Desktop node_modules
|
||||
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
|
@ -120,7 +120,7 @@ jobs:
|
|||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('patches/**') }}
|
||||
- name: Install Desktop node_modules
|
||||
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
|
||||
run: yarn install --frozen-lockfile
|
||||
|
|
|
@ -24,3 +24,64 @@ index 16eab30..0077182 100644
|
|||
-
|
||||
update-mime-database /usr/share/mime || true
|
||||
update-desktop-database /usr/share/applications || true
|
||||
diff --git a/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh b/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
|
||||
index b52822068..3824c785f 100644
|
||||
--- a/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
|
||||
+++ b/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh
|
||||
@@ -62,16 +62,34 @@
|
||||
# to ensure that files are not "in-use"
|
||||
Sleep 300
|
||||
|
||||
- ${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
||||
- ${if} $R0 == 0
|
||||
- # wait to give a chance to exit gracefully
|
||||
- Sleep 1000
|
||||
- nsExec::Exec `taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` $R0
|
||||
- ${If} $R0 != 0
|
||||
- DetailPrint `Waiting for "${PRODUCT_NAME}" to close (taskkill exit code $R0).`
|
||||
- Sleep 2000
|
||||
+ # Retry counter
|
||||
+ StrCpy $R1 0
|
||||
+
|
||||
+ loop:
|
||||
+ IntOp $R1 $R1 + 1
|
||||
+
|
||||
+ ${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0
|
||||
+ ${if} $R0 == 0
|
||||
+ # wait to give a chance to exit gracefully
|
||||
+ Sleep 1000
|
||||
+ nsExec::Exec `taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` $R0
|
||||
+ ${If} $R0 != 0
|
||||
+ DetailPrint `Waiting for "${PRODUCT_NAME}" to close (taskkill exit code $R0).`
|
||||
+ Sleep 2000
|
||||
+ ${endIf}
|
||||
+ ${else}
|
||||
+ Goto not_running
|
||||
${endIf}
|
||||
- ${endIf}
|
||||
+
|
||||
+ # App likely running with elevated permissions.
|
||||
+ # Ask user to close it manually
|
||||
+ ${if} $R1 > 1
|
||||
+ MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDCANCEL IDRETRY loop
|
||||
+ Quit
|
||||
+ ${else}
|
||||
+ Goto loop
|
||||
+ ${endIf}
|
||||
+ not_running:
|
||||
${endIf}
|
||||
${endIf}
|
||||
!macroend
|
||||
diff --git a/node_modules/app-builder-lib/templates/nsis/messages.yml b/node_modules/app-builder-lib/templates/nsis/messages.yml
|
||||
index c35df3573..94c8e9e0c 100644
|
||||
--- a/node_modules/app-builder-lib/templates/nsis/messages.yml
|
||||
+++ b/node_modules/app-builder-lib/templates/nsis/messages.yml
|
||||
@@ -66,6 +66,8 @@ appRunning:
|
||||
fi: "${PRODUCT_NAME} on käynnissä. Napsauta OK sulkeaksesi sen."
|
||||
es: "${PRODUCT_NAME} se está ejecutando. Haz clic en Aceptar para cerrarlo."
|
||||
da: "${PRODUCT_NAME} er i gang. Klik OK for at lukke."
|
||||
+appCannotBeClosed:
|
||||
+ en: "${PRODUCT_NAME} cannot be closed. \nPlease close it manually and click Retry to continue"
|
||||
installing:
|
||||
en: Installing, please wait...
|
||||
de: Installation läuft, bitte warten...
|
||||
|
|
Loading…
Add table
Reference in a new issue