vue-cli-plugin-electron-builder
vue-cli-plugin-electron-builder copied to clipboard
process.on('SIGTERM') event handlers are not executed in main process
Describe the bug
Any signal event handlers (SIGINT
, SIGTERM
) registered in the main process file (background.js
) are not executed when canceling the webpack dev server.
To Reproduce
- Download reproduction project: process-bug.zip
- unzip and cd into directory
-
npm install
-
npm run electron:serve
- Ctrl-C
The console should print main: SIGINT
, but it won't. This tells me the event handlers are not executing.
Expected behavior When hitting ctrl-c, process signal event handlers in the main electron process should execute.
Environment (please complete the following information):
- (if possible) link to your repo: process-bug.zip
- terminal output from running
vue info
:
Environment Info:
System:
OS: macOS 11.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 14.16.0 - /usr/local/n/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.7.4 - /usr/local/n/bin/npm
Browsers:
Chrome: Not Found
Edge: Not Found
Firefox: 88.0.1
Safari: 14.1
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.2.1
@vue/babel-helper-vue-transform-on: 1.0.2
@vue/babel-plugin-jsx: 1.0.6
@vue/babel-plugin-transform-vue-jsx: 1.2.1
@vue/babel-preset-app: 4.5.13
@vue/babel-preset-jsx: 1.2.4
@vue/babel-sugar-composition-api-inject-h: 1.2.1
@vue/babel-sugar-composition-api-render-instance: 1.2.4
@vue/babel-sugar-functional-vue: 1.2.2
@vue/babel-sugar-inject-h: 1.2.2
@vue/babel-sugar-v-model: 1.2.3
@vue/babel-sugar-v-on: 1.2.3
@vue/cli-overlay: 4.5.13
@vue/cli-plugin-babel: ~4.5.0 => 4.5.13
@vue/cli-plugin-eslint: ~4.5.0 => 4.5.13
@vue/cli-plugin-router: 4.5.13
@vue/cli-plugin-vuex: 4.5.13
@vue/cli-service: ~4.5.0 => 4.5.13
@vue/cli-shared-utils: 4.5.13
@vue/component-compiler-utils: 3.2.0
@vue/preload-webpack-plugin: 1.1.2
@vue/web-component-wrapper: 1.3.0
eslint-plugin-vue: ^6.2.2 => 6.2.2
vue: ^2.6.11 => 2.6.12
vue-cli-plugin-electron-builder: ~2.0.0 => 2.0.0
vue-eslint-parser: 7.6.0
vue-hot-reload-api: 2.3.4
vue-loader: 15.9.7 (16.2.0)
vue-style-loader: 4.1.3
vue-template-compiler: ^2.6.11 => 2.6.12
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: 4.5.12
For further example, I've put together another way to demonstrate how it should be behaving: process-test.zip
- Download, unzip, cd into the directory
-
npm install
-
node .
- ctrl-c
You should see logs like this:
pid: 49895
creating server process
[parent][stdout] tick
^Cindex: sigint
parent: received SIGINT
[parent][stdout] child: received SIGINT
[parent][stdout] child exit
[parent][event] disconnect,[]
[parent][event] exit,[1,null]
[parent][event] close,[1,null]
This demonstrates that each sub process was able to register an event handler for SIGINT. The electron main process, however, does not demonstrate this behavior for a reason I have not yet been able to ascertain.