electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.72k stars 1.74k forks source link

Win+NSIS: Command Prompt Windows During Auto Update? #3484

Closed SourceBoy closed 5 years ago

SourceBoy commented 6 years ago

Is there a way to prevent or hide the command prompt window(s) during updates?

When I call autoUpdater.quitAndInstall() to update, cmd prompt windows open about 2, 3 times. The first one asks the user to enter password, the other 1 or 2 windows flash open and close very quickly.

"build": {
  "win": {
    "target": [{
      "target": "nsis",
      "arch": ["x64", "ia32"]
    }]
  },
  "nsis": {
    "artifactName": "myapp-${version}.${ext}",
    "deleteAppDataOnUninstall": true
  }
}
develar commented 6 years ago

I an not aware of such behavior. Strange, from your config I see that it is one click installer. May be it is your app works so on exit?

Please attach updater logs.

SourceBoy commented 6 years ago

The only thing my app.once('quit') does is to write something to a file, and it doesn't open any prompt windows when calling app.quit().

Are the log files in the __update__ folder?

develar commented 6 years ago

Logs https://www.electron.build/auto-update#debugging

SourceBoy commented 6 years ago

Below is the log, but it doesn't seem to indicate anything related to the issue. I'll try it on another Windows.

[2018-11-17 11:03:14.657] [info] Checking for update
[2018-11-17 11:03:16.129] [info] Generated new staging user ID: 6ea1eb00-0f0f-525e-876c-425891018a93
[2018-11-17 11:03:17.292] [info] Found version 1.0.1 (url: myapp-1.0.1.exe)
[2018-11-17 11:03:17.292] [info] Downloading update from myapp-1.0.1.exe
[2018-11-17 11:03:17.307] [info] No cached update info available
[2018-11-17 11:03:17.323] [info] Download block maps (old: "https://generic/myapp-1.0.0.exe.blockmap", new: https://generic/myapp-1.0.1.exe.blockmap)
[2018-11-17 11:03:17.611] [info] File has 129 changed blocks
[2018-11-17 11:03:17.627] [info] Full: 66,669.75 KB, To download: 2,763.78 KB (4%)
[2018-11-17 11:03:23.433] [info] New version 1.0.1 has been downloaded to C:\Users\me\AppData\Roaming\myapp\__update__\myapp-1.0.1.exe
[2018-11-17 11:05:08.428] [info] Install on explicit quitAndInstall
[2018-11-17 11:05:08.434] [info] Install: isSilent: false, isRunAfter: true
[2018-11-17 11:07:12.852] [info] Checking for update
[2018-11-17 11:07:16.467] [info] Update for version 1.0.1 is not available (latest version: 1.0.1, downgrade is disallowed).
develar commented 6 years ago

Could you please try latest versions of electron updater and builder?

SourceBoy commented 6 years ago

I could. I downgraded back to these builder & updater versions because I was getting build errors from one of the higher versions.

azeier commented 5 years ago

I have been having this issue as well. It looks like taskkill in CHECK_APP_RUNNING spawns these command promts.

The easiest way I found for reproducing it is just running the installer multiple times. After the "App is running" warning and proceeding, two command prompts will briefly appear.

Is there a way to silence that?

Edit: Looks like nsExec might be the solution here.