
Show HN: deemon, run a process in the background and attach to it - joaomoreno
https://github.com/joaomoreno/deemon
======
joaomoreno
Hi HN, author here!

We use deemon in VS Code to improve development and minimize downtime. As
developers we like to run our build from within VS Code in order to get tasks
support and get semantic errors in the Problems view. But since we often need
to reload VS Code, this would kill the build task and we would need to start
the build all over again which takes roughly 2-3 minutes to warm up. With
deemon we are able to run the build from inside VS Code as a build task and
later reattach to the same `yarn watch` process, even if we quit VS Code or
reload it.

Deemon works similarly to running your build tasks inside tmux, detaching from
it and later reattaching, but with a simpler interface. Instead of `yarn
watch`, one runs instead `deemon yarn watch`.

Adopting it to the VS Code repo was as simple as adding a dev dependency to
`deemon` and adding a new `watchd` script:
[https://github.com/microsoft/vscode/blob/4e8408d4c4dafae88f7...](https://github.com/microsoft/vscode/blob/4e8408d4c4dafae88f771691920bb54d7ab57c81/package.json#L18).

You can try it out right now using `npx`: simply run `npx deemon BUILD
COMMAND` (eg. `npx deemon yarn watch`). `Ctrl-C` will detach from the
background process. Run the exact same command to reattach. `Ctrl-D` will
terminate the background process.

Glad to answer any questions!

