1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-26 07:39:04 +02:00

fixed Windows update installation

This commit is contained in:
antelle 2021-01-10 09:28:09 +01:00
parent c44a8fab42
commit b82cb0e849
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 7 additions and 6 deletions

View File

@ -951,6 +951,5 @@ function exitAndStartUpdate() {
if (pendingUpdateFilePath) { if (pendingUpdateFilePath) {
const { installUpdate } = require('./scripts/update-installer'); const { installUpdate } = require('./scripts/update-installer');
installUpdate(pendingUpdateFilePath); installUpdate(pendingUpdateFilePath);
main.exit(0);
} }
} }

View File

@ -38,6 +38,8 @@ function installDarwinUpdate(updateFilePath) {
`--dmg=${updateFilePath}`, `--dmg=${updateFilePath}`,
`--app=${appPath}` `--app=${appPath}`
]); ]);
electron.app.exit(0);
} }
function installWin32Update(updateFilePath) { function installWin32Update(updateFilePath) {
@ -48,16 +50,16 @@ function installWin32Update(updateFilePath) {
const appDir = path.dirname(electron.app.getPath('exe')); const appDir = path.dirname(electron.app.getPath('exe'));
const updateCommand = `"${updateFilePath}" /U1 /D=${appDir}`; const updateCommand = `"${updateFilePath}" /U1 /D=${appDir}`;
const tempPath = path.join(electron.app.getPath('temp'), 'KeeWeb'); const ps = spawnDetached('cmd');
const updateLauncherScriptPath = path.join(tempPath, 'update-keeweb.cmd'); ps.stdin.end(`${updateCommand}\nexit\n`, 'utf8', () => {
fs.writeFileSync(updateLauncherScriptPath, updateCommand); electron.app.exit(0);
});
spawnDetached(updateLauncherScriptPath);
} }
function spawnDetached(command, args) { function spawnDetached(command, args) {
const ps = spawn(command, args || [], { detached: true }); const ps = spawn(command, args || [], { detached: true });
ps.unref(); ps.unref();
return ps;
} }
module.exports.installUpdate = installUpdate; module.exports.installUpdate = installUpdate;