Skip to content

Instantly share code, notes, and snippets.

@davidaurelio davidaurelio/.profile
Last active Dec 20, 2015

What would you like to do?
bash helper function to make debugging node cli programs easier.
node-debug () {
PROGRAM="$(which $1)" # make sure we get an absolute path for programs in PATH
shift # remove the original program argument
set -- "$PROGRAM" "$@" # prepend the program path
node --debug-brk $@ & # start node in paused debug mode, send to background
node-inspector # start node inspector
kill %% # kill the background task (if still running)
# if you run your program like this ...
node path/to/program -some parameters --go here
# ... just add '-debug'
node-debug path/to/program -some parameters --go here
# if your program is in PATH ...
program -some parameters --go here
# just prefix with 'node-debug'
node-debug program -some parameters --go here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.