fix: abort ShipIt installation attempt at the final mile if the app is running (#36130)

* fix: abort ShipIt installation attempt at the final mile if the app is running

* chore: remove only

* Update patches/squirrel.mac/fix_abort_installation_attempt_at_the_final_mile_if_the_app_is.patch

Co-authored-by: Jeremy Rose <jeremya@chromium.org>

* chore: update patches

* spec: make the ShipIt process lister helper more resilient

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
Samuel Attard 2022-11-14 10:12:16 -08:00 committed by GitHub
parent 654e571512
commit d8bb172318
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 191 additions and 28 deletions

View file

@ -15,28 +15,34 @@ autoUpdater.on('error', (err) => {
const urlPath = path.resolve(__dirname, '../../../../url.txt');
let feedUrl = process.argv[1];
if (!feedUrl || !feedUrl.startsWith('http')) {
feedUrl = `${fs.readFileSync(urlPath, 'utf8')}/${app.getVersion()}`;
if (feedUrl === 'remain-open') {
// Hold the event loop
setInterval(() => {});
} else {
fs.writeFileSync(urlPath, `${feedUrl}/updated`);
if (!feedUrl || !feedUrl.startsWith('http')) {
feedUrl = `${fs.readFileSync(urlPath, 'utf8')}/${app.getVersion()}`;
} else {
fs.writeFileSync(urlPath, `${feedUrl}/updated`);
}
autoUpdater.setFeedURL({
url: feedUrl
});
autoUpdater.checkForUpdates();
autoUpdater.on('update-available', () => {
console.log('Update Available');
});
autoUpdater.on('update-downloaded', () => {
console.log('Update Downloaded');
autoUpdater.quitAndInstall();
});
autoUpdater.on('update-not-available', () => {
console.error('No update available');
process.exit(1);
});
}
autoUpdater.setFeedURL({
url: feedUrl
});
autoUpdater.checkForUpdates();
autoUpdater.on('update-available', () => {
console.log('Update Available');
});
autoUpdater.on('update-downloaded', () => {
console.log('Update Downloaded');
autoUpdater.quitAndInstall();
});
autoUpdater.on('update-not-available', () => {
console.error('No update available');
process.exit(1);
});