Skip to content
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

feat(launcher): gracefully close browser on sigint #650

Merged
merged 1 commit into from
Jan 28, 2020
Merged

feat(launcher): gracefully close browser on sigint #650

merged 1 commit into from
Jan 28, 2020

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Jan 25, 2020

No description provided.

@dgozman
Copy link
Contributor Author

dgozman commented Jan 27, 2020

Updated, PTAL.


let gracefullyClosing = false;
async function gracefullyClose(): Promise<void> {
// We keep listeners until we are done, to handle 'exit' and 'SIGINT' while
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we calling gracefullyClose on exit? I think this comment is lying to me.

const {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;

async function testSignal(action) {
const options = Object.assign({}, defaultBrowserOptions, {
Copy link
Contributor

@JoelEinbinder JoelEinbinder Jan 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If you want to be fancy, you can do
{...defaultBrowserOptions, dumpio: false, webSocket: true} instead of Object.assign. Up to you :)

res.stdout.on('data', data => {
output += data;
// Uncomment to debug these tests.
// console.log(data.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For your consideration:

Suggested change
// console.log(data.toString());
if (defaultBrowserOptions.dumpio)
console.log(data.toString());

Copy link
Contributor

@JoelEinbinder JoelEinbinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait to test on windows before landing this, but it lgtm.

@JoelEinbinder
Copy link
Contributor

Tested on my computer, seems to work fine.

@JoelEinbinder JoelEinbinder merged commit c04ad14 into microsoft:master Jan 28, 2020
sand4rt pushed a commit to sand4rt/playwright that referenced this pull request Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants