Unable to Terminate Deno Process when using Watch
bugcliregression
### Version
- deno 2.9.1 (stable, release, x86_64-unknown-linux-gnu)
- v8 14.9.207.2-rusty
### Description
When running Deno in `--watch` mode, if the process is performing a long running blocking computation, it's not possible to terminate the watched process via `Ctrl+C`. The user will either need to wait for the computation to complete, or exit the terminal session entirely to terminate the hosting process.
```typescript
// steps to reproduce (compare with `node --watch index.ts` behaviors)
//
// 1) deno run --watch index.ts
// 2) hit ctrl+c (or edit and save index.ts)
// 3) note iteration continues writing to stdout
//
for(let i = 0; i < 100; i++) {
console.log('iteration: ', i)
const start = Date.now()
while((Date.now() - start) < 100) {}
}
```
### Additional
I noticed that it is possible to terminate the above process via `Ctrl+C` if catching the process within an 500ms window of the process starting (catching before the 5th iteration). Not sure if that relates to anything but thought it was worth mentioning.
1 条评论