简体   繁体   中英

In electron app, when I using worker_thread, an exception occurs after using Command+Q to exit the app

My code is very simple:

const { Worker } = require('worker_threads');
let script = `console.log('working...');`;
new Worker(script, { eval: true });

I can see working... output in the console, but when I exit the program with command+q , I see an exception in the console: my-electron-app/node_modules/_electron@11.3.0@electron/dist/Electron.app/Contents/MacOS/Electron exited with signal SIGSEGV

When I run with sudo npm start , I also see a popup about Electron quit unexpectedly 在此处输入图像描述

  • Electron Version: 11.3.0
  • Operating System: macOS 11.2
  • Node: 12.18.3
  • Chrome: 87.0.4280.141

To Reproduce

  1. git clone https://github.com/Vict0r-Chen/electron-worker-threads.git
  2. npm install
  3. npm start | sudo npm start

According to this information , using npm install electron 12.0.0@beta --save-dev to upgrade electron to v12.0.0 can solve this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM