Skip to content

fix: update killProc to retry unsupported taskkill operations with the alternative kill method #26

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

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for being willing to contribute!
> requests from branches on your fork. To do this, run:
>
> ```
> git remote add upstream https://github.com/testing-library/dom-testing-library.git
> git remote add upstream https://github.com/crutchcorn/cli-testing-library.git
> git fetch upstream
> git branch --set-upstream-to=upstream/main main
> ```
Expand Down
9 changes: 8 additions & 1 deletion src/process-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ export const killProc = (instance: TestInstance, signal: string | undefined) =>
}
if (
err.message.includes('could not be terminated') &&
err.message.includes('There is no running instance of the task.')
err.message.includes('There is no running instance of the task.') &&
instance.hasExit()
) {
resolve()
return
}
const isOperationNotSupported = err.message.includes('The operation attempted is not supported.');
const isAccessDenied = err.message.includes('Access is denied.');
if (err.message.includes('could not be terminated') && (isOperationNotSupported || isAccessDenied)) {
const sleep = (t: number) => new Promise(r => setTimeout(r, t))
await sleep(getConfig().errorDebounceTimeout)
if (instance.hasExit()) {
Expand Down