Code for breakfast.

How to inspect an already-running Node.js process

Ever need to debug something in dev but forget to start your process with --inspect? Turns out you can save yourself a restart and take advantage of Unix signals. Just grab your program's PID and run the following:

kill -USR1 $your_process_id

Don't worry, this won't actually terminate the process, it just sends signal to the Node runtime.

You should see the familiar inspector message log in your program's output:

Debugger listening on ws://127.0.0.1:9229/<uid here>
For help see https://nodejs.org/en/docs/inspector

(Tip: If your program eats the output, check chrome://inspect)