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:
parent
c44a8fab42
commit
b82cb0e849
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user