Skip to content

make launcher.kill() synchronous, fs.rm now gets force and maxRetries#268

Merged
paulirish merged 3 commits intomasterfrom
sync-killtime2
May 31, 2022
Merged

make launcher.kill() synchronous, fs.rm now gets force and maxRetries#268
paulirish merged 3 commits intomasterfrom
sync-killtime2

Conversation

@paulirish
Copy link
Copy Markdown
Member

per #266 there's no reason for this to be async. keeping it async adds extra challenges to both debugging and understanding the flow.

also, added a function test for userdatadir removal

for review, turn off whitespace

// backwards support for node v12 + v14.14+
// https://nodejs.org/api/deprecations.html#DEP0147
const rmSync = this.fs.rmSync || this.fs.rmdirSync;
rmSync(this.userDataDir, {recursive: true, force: true});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why set force: true now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

if this dir doesn't exist, we want this fn call to not throw.

@paulirish paulirish merged commit 3724165 into master May 31, 2022
@paulirish paulirish deleted the sync-killtime2 branch May 31, 2022 21:18
// backwards support for node v12 + v14.14+
// https://nodejs.org/api/deprecations.html#DEP0147
const rmSync = this.fs.rmSync || this.fs.rmdirSync;
rmSync(this.userDataDir, {recursive: true, force: true, maxRetries: 10});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you also capture the force / max retry change in the commit title

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oops

@paulirish paulirish changed the title make launcher.kill() synchronous make launcher.kill() synchronous, fs.rm now gets force and maxRetries May 31, 2022
@calebeby
Copy link
Copy Markdown
Contributor

calebeby commented Jun 8, 2022

@paulirish would it make sense to remove the async modifier from the kill function returned by launch() too? Happy to send a PR!

@paulirish
Copy link
Copy Markdown
Member Author

@calebeby yup sg!

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.

3 participants