Skip to content

--watch --on-success should send SIGTERM before sending SIGKILL #964

@JakeIsMeh

Description

@JakeIsMeh

Clear and concise description of the problem

when using tsdown --watch --on-success "node ..." to run a backend service (such as a web server with database connections), tsdown forcibly kills the child process immediately upon a file change to spawn the new process, resulting in graceful shutdown handlers not running.

Suggested solution

change the default restart behavior to send a graceful termination signal first (like SIGTERM or SIGINT), with a fallback to SIGKILL after a timeout if the process hangs.

Alternative

currently a workaround would be skipping --on-success and using concurrently and node --watch or tsx watch, but that requires yet another devDependency which isnt the end of the world but kind of defeats tsdown's elegance of being a reliable all-in-one devtool.

Additional context

tsx watch sends SIGTERM first before sending SIGKILL after 5 seconds (src)

nodemon sends SIGUSR2 first before sending SIGKILL I think

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions