Skip to content

npm - dynoxide orphans and retains port when backgrounded in npm scripts #2

@hicksy

Description

@hicksy

When running dynoxide in the background as part of an npm script, something like... dynoxide & sleep 1 && npm run seed && react-router dev - killing the dev server or hitting Ctrl+C leaves dynoxide running. The port stays in use, and the next npm run dev fails with a port conflict.

A couple of reasons:

  1. The Node.js wrapper uses spawnSync, which I think blocks the event loop and can't register signal or exit handlers. It prob needs switching to async spawn with signal forwarding and parent exit detection.
  2. The Rust server only handles SIGINT (Ctrl+C), not SIGTERM.

Workaround: Kill the orphaned process manually before restarting the npm script.

  • Unix: kill $(lsof -ti :8000)
  • Windows: netstat -ano | findstr :8000 then taskkill /PID <pid> /F (i think, maybe an easier PowerShell one-liner...?)

(replace with whatever port you're using, default is 8000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions