Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Atom Silently Quits when Packages, Command Palette, Toggle, Application:Install Update is clicked #392

Open
DAC324 opened this issue Jun 22, 2022 · 2 comments
Labels
good first issue Good for newcomers

Comments

@DAC324
Copy link

DAC324 commented Jun 22, 2022

Hello all,

Atom just quits without an error message after the following steps:

  1. Start Atom
  2. In the menu, go to Packages, Command Palette Toggle.
  3. Enter install as a search term
  4. Choose and click Application: Install Update

And no, this does not appear to be specific to Arch Linux as it happens with the binary package downloadable from Azure as per Readme.md, as well.
Amendment
The same error happens with the Debian package downloadable from Azure, on a Debian based Linux system.

@DAC324 DAC324 changed the title Atom Crash when Packages, Command Palette, Toggle, Application:Install Update is clicked Atom Silently Quits when Packages, Command Palette, Toggle, Application:Install Update is clicked Jun 27, 2022
@DAC324
Copy link
Author

DAC324 commented Jun 27, 2022

Update:
I investigated the code a little bit and encountered the following:
That behavior of atom closing after having selected Packages->Command Palette->Toggle->(search for install and select) Application: Install Update is actually not a crash but atom silently quitting, because of the following code:

    this.on('application:install-update', () => {
     this.quitting = true;
     this.quittingForUpdate = true;
     this.autoUpdateManager.install();
    });

That line

this.autoUpdateManager.install();

actually seems to do nothing but simply quit the editor.
Why?

this.autoUpdateManager.install();

calls

  install() {
    if (!this.testMode) autoUpdater.quitAndInstall();
  }

where autoupdater is calling electron itself:

  initialize() {
    if (process.platform === 'win32') {
      const archSuffix = process.arch === 'ia32' ? '' : `-${process.arch}`;
      this.feedUrl =
        this.updateUrlPrefix +
        `/api/updates${archSuffix}?version=${this.version}&os_version=${
          os.release
        }`;
      autoUpdater = require('./auto-updater-win32');
    } else {
      this.feedUrl =
        this.updateUrlPrefix +
        `/api/updates?version=${this.version}&os_version=${os.release}`;
      ({ autoUpdater } = require('electron'));
    }

Indeed, that's not very elegant to simply quit because auto updates do not seem to be supported on Linux

    switch (process.platform) {
      case 'win32':
        if (!autoUpdater.supportsUpdates()) {
          this.setState(UnsupportedState);
        }
        break;
      case 'linux':
        this.setState(UnsupportedState);
    }

but that's the way it's actually implemented :(

Would be a lot better to simply alert() that this feature is not yet implemented on Linux, instead of simply quitting the whole program.

@DAC324
Copy link
Author

DAC324 commented Jun 27, 2022

Here's a patch that exactly achieves this. Instead of simply quitting atom on Linux when Packages->Command Palette->Toggle->(search for install and select) Application: Install Update is clicked, there is a dialog indicating that this feature is not yet supported on Linux:

--- a/src/main-process/auto-update-manager.js	2022-06-24 18:26:06.425993344 +0200
+++ b/src/main-process/auto-update-manager.js	2022-06-27 12:41:17.818911759 +0200
@@ -162,7 +162,22 @@
   }
 
   install() {
-    if (!this.testMode) autoUpdater.quitAndInstall();
+    if (process.platform === 'win32') {
+        if (!this.testMode) autoUpdater.quitAndInstall();
+    }
+    else
+    {
+        const { dialog } = require('electron');
+        dialog.showMessageBox({
+           type: 'info',
+           buttons: ['OK'],
+           icon: this.iconPath,
+           message: 'This feature is not supported on your platform.',
+           title: 'No Update Available',
+           detail: `Automatic update download and installation not yet supported.`
+        });
+    }
+
   }
 
   onUpdateNotAvailable() {

@icecream17 icecream17 changed the title Atom Silently Quits when Packages, Command Palette, Toggle, Application:Install Update is clicked Linux: Atom Silently Quits when Packages, Command Palette, Toggle, Application:Install Update is clicked Oct 3, 2023
@icecream17 icecream17 added the good first issue Good for newcomers label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants