-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit gracefully on linux #12139
Exit gracefully on linux #12139
Conversation
Singleton now sends the "we've started" message out only after it's received a `'ready'` event from `app`. Previously it sent the message out immediately, resulting in the parent test trying to manipulate it before Singleton's event loop was fully bootstrapped.
Rewrite the "exits gracefully on macos" spec to run on Linux too.
In the 'exits gracefully' test for app.exit(exitCode), print the relevant error information if the test fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 ty for this, solves such a key flake
@ckerr it appears it's successful on mac and linux but that it's failing on windows. After 👀-ing some documentation, it looks like
I think this is still workable cross-platform but we'll have to include a separate handler for |
Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and subprocess.kill(). Sending signal 0 can be used to test for the existence of a process. Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional termination of the target process. So, we'll need a different approach if we want to test this in win32.
@codebytere, thank you for doing the win32 research on this! I agree we'll need a different approach for win32. Simulating SIGTERM is a good Node feature, but forcing an unconditional exit doesn't give us a meaningful test when we're looking for a graceful shutdown. So let's limit this implementation of the test to macOS and Linux. |
in that case, i'll merge when CI goes ✅✨ |
I would vote for backporting the change to |
* Fix timing issue in singleton fixture. Singleton now sends the "we've started" message out only after it's received a `'ready'` event from `app`. Previously it sent the message out immediately, resulting in the parent test trying to manipulate it before Singleton's event loop was fully bootstrapped. * Check for graceful exits on Linux, too. Rewrite the "exits gracefully on macos" spec to run on Linux too. * Check for graceful exits everywhere. * Tweak comment * Better error logging in api-app-spec.js. (#12122) In the 'exits gracefully' test for app.exit(exitCode), print the relevant error information if the test fails. * Run the exit-gracefully test on macOS and Linux. Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and subprocess.kill(). Sending signal 0 can be used to test for the existence of a process. Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional termination of the target process. So, we'll need a different approach if we want to test this in win32.
done, pr up |
* Fix timing issue in singleton fixture. Singleton now sends the "we've started" message out only after it's received a `'ready'` event from `app`. Previously it sent the message out immediately, resulting in the parent test trying to manipulate it before Singleton's event loop was fully bootstrapped. * Check for graceful exits on Linux, too. Rewrite the "exits gracefully on macos" spec to run on Linux too. * Check for graceful exits everywhere. * Tweak comment * Better error logging in api-app-spec.js. (electron#12122) In the 'exits gracefully' test for app.exit(exitCode), print the relevant error information if the test fails. * Run the exit-gracefully test on macOS and Linux. Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and subprocess.kill(). Sending signal 0 can be used to test for the existence of a process. Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional termination of the target process. So, we'll need a different approach if we want to test this in win32.
Fixes not ok 11 app module app.exit(exitCode) exits gracefully on macos #12050 which was caused by a timing issue. The singleton fixture was reporting its readiness before app had emitted a 'ready' signal. At times, this could cause the parent test harness to run its tests before the child Electron process had finished starting its event loop.
Rewrites the
exit_gracefully_on_macos()
test to run on other platforms too.This code is ready for review but is a WIP in the sense that I need confirmation from CI about the portability of the rewritten test.