Skip to content

Commit

Permalink
fix: Windows should now kill tasks properly
Browse files Browse the repository at this point in the history
* fix: retry unsupported taskkill operations with alternative method

* update contributing readme to refer to cli-testing-library repo
  • Loading branch information
Waldeedle authored Jan 2, 2024
1 parent 4e77f64 commit eb11d55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit eb11d55

Please sign in to comment.