Giter VIP home page Giter VIP logo

Comments (4)

nlawrence22 avatar nlawrence22 commented on June 25, 2024 1

I spoke too soon -- I can now reliably reproduce this.

Apparently there's a difference in the way that the app is executed if you double-click [Your Electron App].app or if you navigate inside the app-bundle and run the shell script there ([Your Electron App].app > Contents > MacOS > [Your Electron App]) -- the former breaks quit, the latter does not, even when using the same app bundle that requires fix-path. I was previously using the latter, which is why I wasn't able to reproduce.

Here are the steps to reproduce (on a mac):

  1. git clone https://github.com/electron/electron-quick-start exampleApp
  2. cd exampleApp
  3. yarn add fix-path
  4. yarn add electron-packager --dev
  5. Add require('fix-path')(); to the top of main.js (I also tried after the require of electron or of path -- didn't seem to matter where in the file it was)
  6. Add the following script definition in package.json "package": "electron-packager . test --overwrite"
  7. yarn run package
  8. Navigate to exampleApp/test-darwin-x64/ in finder
  9. Double-click test.app
  10. Right-click the dock and select Quit

Note that if you instead navigate to exampleApp/test-darwin-x64/test.app/Contents/MacOS/ and double click test then you can quit as expected.

Here's a git patch showing all of the changes on top of the base electron-quick-start repo required to repro this:

diff --git a/main.js b/main.js
index 07561fa..0f450b3 100644
--- a/main.js
+++ b/main.js
@@ -1,3 +1,4 @@
+require('fix-path')();
 const electron = require('electron')
 // Module to control application life.
 const app = electron.app
diff --git a/package.json b/package.json
index 4386fec..8670a28 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
   "description": "A minimal Electron application",
   "main": "main.js",
   "scripts": {
-    "start": "electron ."
+    "start": "electron .",
+    "package": "electron-packager . test --overwrite"
   },
   "repository": "https://github.com/electron/electron-quick-start",
   "keywords": [
@@ -17,6 +18,10 @@
   "author": "GitHub",
   "license": "CC0-1.0",
   "devDependencies": {
-    "electron": "~1.7.8"
+    "electron": "~1.7.8",
+    "electron-packager": "^11.0.1"
+  },
+  "dependencies": {
-    "start": "electron ."
+    "start": "electron .",
+    "package": "electron-packager . test --overwrite"
   },
   "repository": "https://github.com/electron/electron-quick-start",
   "keywords": [
@@ -17,6 +18,10 @@
   "author": "GitHub",
   "license": "CC0-1.0",
   "devDependencies": {
-    "electron": "~1.7.8"
+    "electron": "~1.7.8",
+    "electron-packager": "^11.0.1"
+  },
+  "dependencies": {
+    "fix-path": "^2.1.0"
   }
 }

I'll spend a little time looking into shell-env next, but you should be able to reproduce this at will with these steps.

As a side note, I'm willing to accept this could be an issue with how electron-packager is bundling things, or with electron itself, but I'd ask for your help filing an issue against those projects if that's determined to be the cause, since electron has already closed this issue once as "due to an issue in a 3rd party module".

from fix-path.

nlawrence22 avatar nlawrence22 commented on June 25, 2024

For reference, the hotkey ⌘Q does work, as does Force Quitting the app.

from fix-path.

silverwind avatar silverwind commented on June 25, 2024

Maybe a stuck child process? Try https://github.com/sindresorhus/shell-env and check if the promise it returns resolves. Also check with pstree or similar tools if your app has child processes.

from fix-path.

nlawrence22 avatar nlawrence22 commented on June 25, 2024

My understanding was that any electron app will have at least 1 child process, since there's the main process and the render process, correct? My app doesn't have child processes other than the 2 render processes typical of electron, similar to:

nlawrence-6148:~ nlawrence$ pstree -w -p 40093
-+= 00001 root /sbin/launchd
 \-+= 38205 nlawrence /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
   \-+= 39944 root login -pf nlawrence
     \-+= 39945 nlawrence -bash
       \-+= 40093 nlawrence /Users/nlawrence/projects/testFixPath/testfixpath-darwin-x64/testfixpath.app/Contents/MacOS/testfixpath
         |--- 40094 nlawrence /Users/nlawrence/projects/testFixPath/testfixpath-darwin-x64/testfixpath.app/Contents/Frameworks/testfixpath Helper.app/Contents/MacOS/testfixpath Helper --type=gpu-process --no-sandbox --supports-dual-gpus=true --gpu-driver-bug-workarounds=0,1,10,23,25,36,39,40,47,53,61,63,64,65,66,68,73,74,76,84,85,86,89,92 --disable-gl-extensions=GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent --gpu-vendor-id=0x1002 --gpu-device-id=0x67ef --gpu-driver-vendor --gpu-driver-version --gpu-driver-date --gpu-secondary-vendor-ids=0x8086 --gpu-secondary-device-ids=0x191b --gpu-active-vendor-id=0x8086 --gpu-active-device-id=0x191b --service-request-channel-token=F8B8D03B2B7DA14AE3390044FDC57087
         \--- 40095 nlawrence /Users/nlawrence/projects/testFixPath/testfixpath-darwin-x64/testfixpath.app/Contents/Frameworks/testfixpath Helper.app/Contents/MacOS/testfixpath Helper --type=renderer --no-sandbox --primordial-pipe-token=D2743DBC268ADC46AF52275F4A4A7AB9 --lang=en-US --app-path=/Users/nlawrence/projects/testFixPath/testfixpath-darwin-x64/testfixpath.app/Contents/Resources/app --node-integration=true --webview-tag=true --no-sandbox --enable-pinch --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --content-image-texture-target=0,0,3553;0,1,3553;0,2,3553;0,3,3553;0,4,3553;0,5,3553;0,6,3553;0,7,3553;0,8,3553;0,9,3553;0,10,34037;0,11,34037;0,12,34037;0,13,3553;0,14,3553;0,15,3553;1,0,3553;1,1,3553;1,2,3553;1,3,3553;1,4,3553;1,5,3553;1,6,3553;1,7,3553;1,8,3553;1,9,3553;1,10,34037;1,11,34037;1,12,34037;1,13,3553;1,14,3553;1,15,3553;2,0,3553;2,1,3553;2,2,3553;2,3,3553;2,4,3553;2,5,3553;2,6,3553;2,7,3553;2,8,3553;2,9,3553;2,10,34037;2,11,34037;2,12,34037;2,13,3553;2,14,3553;2,15,3553;3,0,3553;3,1,3553;3,2,3553;3,3,3553;3,4,3553;3,5,34037;3,6,3553;3,7,3553;3,8,3553;3,9,3553;3,10,3553;3,11,3553;3,12,34037;3,13,3553;3,14,34037;3,15,34037;4,0,3553;4,1,3553;4,2,3553;4,3,3553;4,4,3553;4,5,34037;4,6,3553;4,7,3553;4,8,3553;4,9,3553;4,10,3553;4,11,3553;4,12,34037;4,13,3553;4,14,34037;4,15,34037 --service-request-channel-token=D2743DBC268ADC46AF52275F4A4A7AB9 --renderer-client-id=4

That being said, I've run through @wuww5511 's steps from the linked issue, and I'm not able to reproduce with their minimal app, so there's probably a piece missing. It's definitely still happening in my app (and if I comment out the include of fix-path, quitting works as expected). I'll do a bit more digging and see if I can come up with a set of reproducible steps.

from fix-path.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.