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

Launcher: force kill chrome in case of working with temporary profile. #693

Closed
wants to merge 1 commit into from

Conversation

aslushnikov
Copy link
Contributor

This patch:

  • in case of user-supplied profile directory, starts gracefully closing
    chrome so that it doesn't corrupt profile
  • in case of temp profile directory, force-closes chrome and proactively
    tries to remove temp directory to avoid littering

Fixes #527.

This patch:
- in case of user-supplied profile directory, starts gracefully closing
  chrome so that it doesn't corrupt profile
- in case of temp profile directory, force-closes chrome and proactively
  tries to remove temp directory to avoid littering

Fixes puppeteer#527.
@aslushnikov
Copy link
Contributor Author

@JoelEinbinder could you please check how this behaves on Windows?

process.kill(-chromeProcess.pid, 'SIGKILL');
// Attempt to remove temporary profile directory to avoid littering.
try {
removeSync(temporaryUserDataDir);
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't the 'close' event handle this? Or we try just in case the close never happens?

} else {
// Terminate chrome gracefully.
if (process.platform === 'win32')
childProcess.execSync(`taskkill /pid ${chromeProcess.pid} /T`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This didn't work for me on Windows.

This process can only be terminated forcefully (with /F option)

I'll send a PR with what worked for me.

Copy link
Collaborator

@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.

It doesn't work :(

@aslushnikov
Copy link
Contributor Author

Closing in favor of #700

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.

using --user-data-dir=profilepath corrupts settings and remove all extensions
2 participants