diff --git a/docs/Auto Update.md b/docs/Auto Update.md
index 38737623c37..11630c4523a 100644
--- a/docs/Auto Update.md
+++ b/docs/Auto Update.md
@@ -173,7 +173,7 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do
* [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined
\| null
\| String
* [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL)
* [`.loadUpdateConfig()`](#module_electron-updater.AppUpdater+loadUpdateConfig) ⇒ Promise<any>
- * [`.quitAndInstall(isSilent)`](#module_electron-updater.AppUpdater+quitAndInstall)
+ * [`.quitAndInstall(isSilent, isForceRunAfter)`](#module_electron-updater.AppUpdater+quitAndInstall)
* [.UpdaterSignal](#UpdaterSignal)
* [`.login(handler)`](#module_electron-updater.UpdaterSignal+login)
* [`.progress(handler)`](#module_electron-updater.UpdaterSignal+progress)
@@ -253,7 +253,7 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do
* [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ undefined
\| null
\| String
* [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL)
* [`.loadUpdateConfig()`](#module_electron-updater.AppUpdater+loadUpdateConfig) ⇒ Promise<any>
- * [`.quitAndInstall(isSilent)`](#module_electron-updater.AppUpdater+quitAndInstall)
+ * [`.quitAndInstall(isSilent, isForceRunAfter)`](#module_electron-updater.AppUpdater+quitAndInstall)
#### `appUpdater.checkForUpdates()` ⇒ Promise<[UpdateCheckResult](#UpdateCheckResult)>
@@ -288,7 +288,7 @@ Configure update provider. If value is `string`, [module:electron-builder-http/o
#### `appUpdater.loadUpdateConfig()` ⇒ Promise<any>
**Kind**: instance method of [AppUpdater
](#AppUpdater)
-#### `appUpdater.quitAndInstall(isSilent)`
+#### `appUpdater.quitAndInstall(isSilent, isForceRunAfter)`
Restarts the app and installs the update after it has been downloaded.
It should only be called after `update-downloaded` has been emitted.
@@ -300,6 +300,7 @@ This is different from the normal quit event sequence.
| Param | Type | Description |
| --- | --- | --- |
| isSilent | Boolean
| *windows-only* Runs the installer in silent mode. |
+| isForceRunAfter | Boolean
| *windows-only* Run the app after finish even on silent install. |
### UpdaterSignal
diff --git a/docs/Options.md b/docs/Options.md
index 98cb3995097..feb1d390025 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -305,9 +305,10 @@ Configuration Options
* `languages` Array<String> | String - The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store. The first entry (index 0) will be the default language. Defaults to en-US if omitted.
* `artifactName` String - The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern).
* `publish` String | [GithubOptions](Publishing-Artifacts#GithubOptions) | [S3Options](Publishing-Artifacts#S3Options) | [GenericServerOptions](Publishing-Artifacts#GenericServerOptions) | [BintrayOptions](Publishing-Artifacts#BintrayOptions) | Array
-* `squirrelWindows` - Squirrel.Windows options.
+* `squirrelWindows` - Squirrel.Windows options. Squirrel.Windows target is maintained, but deprecated. Please use `nsis` instead.
- To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency. Squirrel.Windows target is maintained, but deprecated. Please use `nsis` instead.
+ To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
+ To build for Squirrel.Windows on macOS, please install `mono`: `brew install mono`.
Inherits [WinBuildOptions](#WinBuildOptions) options.
* `iconUrl` String - A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon.
diff --git a/packages/electron-builder/src/util/bundledTool.ts b/packages/electron-builder/src/util/bundledTool.ts
index dd905db6a92..b6e0776c839 100644
--- a/packages/electron-builder/src/util/bundledTool.ts
+++ b/packages/electron-builder/src/util/bundledTool.ts
@@ -3,16 +3,19 @@ import { getBinFromGithub } from "electron-builder-util/out/binDownload"
// 2 minutes
export const EXEC_TIMEOUT = {timeout: 120 * 1000}
+/** @internal */
export interface ToolInfo {
path: string
env?: any
}
+/** @internal */
export function computeEnv(oldValue: string | null | undefined, newValues: Array): string {
let parsedOldValue = oldValue ? oldValue.split(":") : []
return newValues.concat(parsedOldValue).filter(it => it.length > 0).join(":")
}
+/** @internal */
export function computeToolEnv(libPath: Array): any {
// noinspection SpellCheckingInspection
return Object.assign({}, process.env, {
@@ -20,6 +23,7 @@ export function computeToolEnv(libPath: Array): any {
})
}
+/** @private */
export function getLinuxToolsPath() {
//noinspection SpellCheckingInspection
return getBinFromGithub("linux-tools", "mac-10.12", "DowDogHsS6X4a5au4r8T8qYprf7hqjfzcU7DL5oiD43jhZMfkQOjmFFYC1s7Lp9ARXp+sm8OJhuwaqCHMVGZYg==")
diff --git a/packages/electron-builder/src/util/macosVersion.ts b/packages/electron-builder/src/util/macosVersion.ts
index 003b5ea90d1..9f1f1056c3e 100644
--- a/packages/electron-builder/src/util/macosVersion.ts
+++ b/packages/electron-builder/src/util/macosVersion.ts
@@ -20,6 +20,7 @@ export async function isOsVersionGreaterThanOrEqualTo(input: string) {
return semver.gte(await macOsVersion.value, clean(input))
}
+/** @internal */
export async function isMacOsSierra() {
return process.platform === "darwin" && await isOsVersionGreaterThanOrEqualTo("10.12")
}
\ No newline at end of file
diff --git a/packages/electron-builder/src/util/wine.ts b/packages/electron-builder/src/util/wine.ts
index aaa5b513d0b..c4ce11178c8 100644
--- a/packages/electron-builder/src/util/wine.ts
+++ b/packages/electron-builder/src/util/wine.ts
@@ -24,6 +24,7 @@ const wineExecutable = new Lazy(async () => {
return {path: "wine"}
})
+/** @private */
export function execWine(file: string, args: Array, options: ExecOptions = EXEC_TIMEOUT): Promise {
if (process.platform === "win32") {
return exec(file, args, options)
@@ -34,6 +35,7 @@ export function execWine(file: string, args: Array, options: ExecOptions
}
}
+/** @private */
export function prepareArgs(args: Array, exePath: string) {
if (process.platform !== "win32") {
args.unshift(exePath)
diff --git a/packages/electron-builder/templates/nsis/common.nsh b/packages/electron-builder/templates/nsis/common.nsh
index 745692f2b22..145064e1868 100644
--- a/packages/electron-builder/templates/nsis/common.nsh
+++ b/packages/electron-builder/templates/nsis/common.nsh
@@ -54,6 +54,14 @@ Name "${PRODUCT_NAME}"
!macroend
!define Updated `"" Updated ""`
+!macro _ForceRun _a _b _t _f
+ ClearErrors
+ ${GetParameters} $R9
+ ${GetOptions} $R9 "--force-run" $R8
+ IfErrors `${_f}` `${_t}`
+!macroend
+!define ForceRun `"" ForceRun ""`
+
!macro extractEmbeddedAppPackage
!ifdef COMPRESS
SetCompress off
diff --git a/packages/electron-builder/templates/nsis/installSection.nsh b/packages/electron-builder/templates/nsis/installSection.nsh
index 019331d84ca..2d3ea5b73ce 100644
--- a/packages/electron-builder/templates/nsis/installSection.nsh
+++ b/packages/electron-builder/templates/nsis/installSection.nsh
@@ -210,6 +210,7 @@ ${endif}
!ifdef ONE_CLICK
!ifdef RUN_AFTER_FINISH
${IfNot} ${Silent}
+ ${OrIf} ${ForceRun}
# otherwise app window will be in backround
HideWindow
!insertmacro StartApp
diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts
index eedb55984cd..566e4a8dbdd 100644
--- a/packages/electron-updater/src/AppUpdater.ts
+++ b/packages/electron-updater/src/AppUpdater.ts
@@ -295,8 +295,9 @@ export abstract class AppUpdater extends EventEmitter {
* This is different from the normal quit event sequence.
*
* @param isSilent *windows-only* Runs the installer in silent mode.
+ * @param isForceRunAfter *windows-only* Run the app after finish even on silent install.
*/
- abstract quitAndInstall(isSilent?: boolean): void
+ abstract quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void
async loadUpdateConfig() {
if (this._appUpdateConfigPath == null) {
diff --git a/packages/electron-updater/src/NsisUpdater.ts b/packages/electron-updater/src/NsisUpdater.ts
index 1c6be71099c..1dddca65c86 100644
--- a/packages/electron-updater/src/NsisUpdater.ts
+++ b/packages/electron-updater/src/NsisUpdater.ts
@@ -134,17 +134,17 @@ export class NsisUpdater extends AppUpdater {
this.app.on("quit", () => {
this._logger.info("Auto install update on quit")
- this.install(true)
+ this.install(true, false)
})
}
- quitAndInstall(isSilent: boolean = false): void {
- if (this.install(isSilent)) {
+ quitAndInstall(isSilent: boolean = false, isForceRunAfter: boolean = false): void {
+ if (this.install(isSilent, isForceRunAfter)) {
this.app.quit()
}
}
- private install(isSilent: boolean): boolean {
+ private install(isSilent: boolean, isForceRunAfter: boolean): boolean {
if (this.quitAndInstallCalled) {
return false
}
@@ -163,6 +163,11 @@ export class NsisUpdater extends AppUpdater {
if (isSilent) {
args.push("/S")
}
+
+ if (isForceRunAfter) {
+ args.push("--force-run")
+ }
+
const spawnOptions = {
detached: true,
stdio: "ignore",