paymoapp / electron-shutdown-handler Goto Github PK
View Code? Open in Web Editor NEWHandle shutdown messages on windows in your electron app and delay system shutdown
License: MIT License
Handle shutdown messages on windows in your electron app and delay system shutdown
License: MIT License
ElectronShutdownHandler.on('shutdown', async () => {
logger.warn('shutdown quit 1')
await sleep(3000) // = wind reg ProxyEnable
logger.warn('shutdown quit 2')
ElectronShutdownHandler.releaseShutdown()
app.quit()
})
Now it shuts down when the "shutdown quit 2" is not executed
Thank you so much for creating this lib. It saved my day!
In the code block, I think you meant to write ElectronShutdownHandler
not Electron.ShutdownHandler
:)
Error logs:
prebuild info begin Prebuild version 11.0.4
prebuild info build Preparing to prebuild @paymoapp/[email protected] for napi 6 on win32-x64 using node-gyp
prebuild info find Python using Python version 3.11.6 found at "C:\Users\xxx\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe"
prebuild ERR! find VS
prebuild ERR! find VS msvs_version not set from command line or npm config
prebuild ERR! find VS running in VS Command Prompt, installation path is:
prebuild ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
prebuild ERR! find VS - will only use this version
prebuild ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
prebuild ERR! find VS could not find a version of Visual Studio 2017 or newer to use
prebuild ERR! find VS looking for Visual Studio 2015
prebuild ERR! find VS - not found
prebuild ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
prebuild ERR! find VS
prebuild ERR! find VS
**************************************************************
prebuild ERR! find VS You need to install the latest version of Visual Studio
prebuild ERR! find VS including the "Desktop development with C++"
prebuild ERR! find VS For more information consult the documentation at:
prebuild ERR! find VS https://github.com/nodejs/node-gyp#on-windows
prebuild ERR! find VS
**************************************************************
prebuild ERR! find VS
prebuild ERR! configure error
prebuild ERR! stack Error: Could not find any Visual Studio installation to use
prebuild ERR! stack at VisualStudioFinder.fail (C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
prebuild ERR! stack at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:74:16
prebuild ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
prebuild ERR! stack at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:70:14
prebuild ERR! stack at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:372:16
prebuild ERR! stack at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\util.js:54:7
prebuild ERR! stack at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\util.js:33:16
prebuild ERR! stack at ChildProcess.exithandler (node:child_process:427:5)
prebuild ERR! stack at ChildProcess.emit (node:events:514:28)
prebuild ERR! stack at maybeClose (node:internal/child_process:1091:16)
prebuild ERR! not ok
prebuild ERR! build Error: Could not find any Visual Studio installation to use
prebuild ERR! build at VisualStudioFinder.fail (C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
prebuild ERR! build at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:74:16
prebuild ERR! build at VisualStudioFinder.findVisualStudio2013 (C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
prebuild ERR! build at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:70:14
prebuild ERR! build at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\find-visualstudio.js:372:16
prebuild ERR! build at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\util.js:54:7
prebuild ERR! build at C:\Users\xxx\Desktop\electron-shutdown-handler\node_modules\prebuild\node_modules\node-gyp\lib\util.js:33:16
prebuild ERR! build at ChildProcess.exithandler (node:child_process:427:5)
prebuild ERR! build at ChildProcess.emit (node:events:514:28)
prebuild ERR! build at maybeClose (node:internal/child_process:1091:16)
I cannot find rmlogotext.exe in the project, neither after running npm run build nor in the release files.
Is it possible to solve this error. It saying setWindowHandle is not a function and it's undefined.
Windows 11
Hi. This lib works fine when i test it on development, but if i build for production with electron-builder i get this error on app startup:
"Error: Cannot find module '@paymoapp/electron-shutdown-handler' Require stack: pathToAppData/app.asar/background.js".
It is not installed as dev dependency, so that shouldn't be an issue. Any idea what could be the problem? Thank you
I have an Electron app that doesn't have any window, only a tray icon.
Unfortunately, tray icons do not have have a getNativeWindowHandle()
method to supply to ElectronShutdownHandler.setWindowHandle
.
Do you have any ideas on how can I still add the shutdown handler to my app?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.