Update on Deno Watch Mode Signal Issue.

Published: (December 13, 2025 at 11:34 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

There is an issue in Deno where the signal handler doesn’t work in watch mode. I believe this happens because the Deno file watcher doesn’t send the INT signal to the worker, causing it to just stop instead. I’m confident about this now.

Source in Deno

select! {
    _ = receiver_future => {},
    _ = deno_signals::ctrl_c() => {
        return Ok(()); // this line handled the INT signal and fulfilled select!
    },
    _ = restart_rx.recv() => {
        print_after_restart();
        continue;
    },
    success = operation_future => { /* ... */ }
}

In the Deno code, the select! statement acts like JavaScript’s Promise.any. It completes as soon as the INT signal is ignored. The operation_future runs the user’s JavaScript or TypeScript files, but it doesn’t get a chance to activate the user‑defined listener.

How Node.js Handles Signals in Watch Mode

Node.js sends the signal to the worker and waits for the worker to finish.

async function killAndWait(signal = kKillSignal, force = false) {
  child?.removeAllListeners();
  if (!child) {
    return;
  }
  if ((child.killed || exited) && !force) {
    return;
  }
  const onExit = once(child, 'exit');
  child.kill(signal);
  const { 0: exitCode } = await onExit;
  return exitCode;
}

source

Proposed Approach for Deno

I plan to adopt a similar strategy: send the signal to the worker to trigger the listener and then wait for it to complete. This should allow user‑defined signal handlers to run correctly in watch mode.

Back to Blog

Related posts

Read more »

Common Rust Lifetime Misconceptions

Article URL: https://github.com/pretzelhammer/rust-blog/blob/master/posts/common-rust-lifetime-misconceptions.md Comments URL: https://news.ycombinator.com/item...

Rython - New Programming language!

Who am I Maybe you already know—if so, you’re doing great, thanks for reading my posts! If not, I’m Igor, a Ukrainian developer who created a Neovim plugin tha...