From 7a9d22046a887d19932fe3c6f482c424406c0931 Mon Sep 17 00:00:00 2001 From: develar Date: Sun, 18 Mar 2018 18:24:58 +0100 Subject: [PATCH] fix(nsis): Single quote in a product name leads to NSIS failure Close #2686 --- .circleci/config.yml | 2 +- .../nsis/include/allowOnlyOneInstallerInstance.nsh | 8 ++++---- .../windows/__snapshots__/oneClickInstallerTest.js.snap | 4 ++-- test/src/helpers/checkDeps.ts | 4 ++-- test/src/windows/oneClickInstallerTest.ts | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 17d9c3a2ec2..c7f46b8b110 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 jobs: build: docker: - - image: circleci/node:9.5 + - image: circleci/node:9.8 steps: - checkout - restore_cache: diff --git a/packages/electron-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh b/packages/electron-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh index a907f972464..b6d0098a070 100644 --- a/packages/electron-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +++ b/packages/electron-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh @@ -45,10 +45,10 @@ Var pid doStopProcess: - DetailPrint 'Closing running "${PRODUCT_NAME}"...' + DetailPrint `Closing running "${PRODUCT_NAME}"...` # https://github.com/electron-userland/electron-builder/issues/2516#issuecomment-372009092 - ExecWait 'taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"' $R0 + ExecWait `taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` $R0 # to ensure that files are not "in-use" Sleep 100 @@ -57,9 +57,9 @@ Var pid # wait to give a chance to exit gracefully Sleep 1000 # do not use /t tree kill - app was killed softly already - ExecWait 'taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"' $R0 + ExecWait `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).' + DetailPrint `Waiting for "${PRODUCT_NAME}" to close (taskkill exit code $R0).` Sleep 2000 ${endIf} ${endIf} diff --git a/test/out/windows/__snapshots__/oneClickInstallerTest.js.snap b/test/out/windows/__snapshots__/oneClickInstallerTest.js.snap index 93f648e2919..a28df0b4185 100644 --- a/test/out/windows/__snapshots__/oneClickInstallerTest.js.snap +++ b/test/out/windows/__snapshots__/oneClickInstallerTest.js.snap @@ -259,7 +259,7 @@ Object { "win": Array [ Object { "arch": "ia32", - "file": "Test Menu Category CustomName 1.1.0.exe", + "file": "Test Menu Category ' CustomName 1.1.0.exe", "safeArtifactName": "test-menu-category-setup-1.1.0.exe", "updateInfo": Object { "sha512": "@sha512", @@ -267,7 +267,7 @@ Object { }, }, Object { - "file": "Test Menu Category CustomName 1.1.0.exe.blockmap", + "file": "Test Menu Category ' CustomName 1.1.0.exe.blockmap", "safeArtifactName": "test-menu-category-setup-1.1.0.exe.blockmap", "updateInfo": Object { "sha512": "@sha512", diff --git a/test/src/helpers/checkDeps.ts b/test/src/helpers/checkDeps.ts index 4120d11c23e..4f56ff1ad38 100644 --- a/test/src/helpers/checkDeps.ts +++ b/test/src/helpers/checkDeps.ts @@ -28,9 +28,9 @@ async function check(projectDir: string, devPackageData: any): Promise // console.log(result) - const unusedDependencies = packageName === "electron-builder" ? + const unusedDependencies = (packageName === "electron-builder" ? result.dependencies.filter(it => it !== "electron-download-tf" && it !== "dmg-builder") : - result.dependencies + result.dependencies).filter(it => it !== "bluebird-lst") if (unusedDependencies.length > 0) { console.error(`${chalk.bold(packageName)} Unused dependencies: ${JSON.stringify(unusedDependencies, null, 2)}`) return false diff --git a/test/src/windows/oneClickInstallerTest.ts b/test/src/windows/oneClickInstallerTest.ts index 0391987c4e1..b20f078b6c7 100644 --- a/test/src/windows/oneClickInstallerTest.ts +++ b/test/src/windows/oneClickInstallerTest.ts @@ -179,7 +179,7 @@ test.ifAll.ifNotCiMac("string menuCategory", app({ config: { extraMetadata: { name: "test-menu-category", - productName: "Test Menu Category" + productName: "Test Menu Category '" }, publish: null, nsis: {