在Electron App中,app.quit()&ap.exit(0)无法终止进程,如何处理?

In Electron App,app.quit()&&ap.exit(0) can not teminate the process,how to deal with this?

我的电脑是mac,Cmd+Q无法退出electron app!为什么?我该怎么办?

根据方法的文档app.exit(exitCode):

All windows will be closed immediately without asking user and the before-quit and will-quit events will not be emitted.

So on On OS X 应用程序及其菜单栏保持活动状态是很常见的。尝试以下方法或将方法 app.exit() 更改为 app.quit()

app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});