Created
February 3, 2012 16:15
-
-
Save mattbornski/1730918 to your computer and use it in GitHub Desktop.
Streamlining node-inspector on Mac OS X (Debugging, NodeJS, Node Inspector, Javascript, Mac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_TCP_PORT=`jot -r 1 10000 65000` | |
while : | |
do | |
# Check to see if this port is allocated | |
lsof -i 4TCP:$_TCP_PORT || break | |
_TCP_PORT=`jot -r 1 10000 65000` | |
done | |
node-inspector --web-port=$_TCP_PORT & | |
python -c "import webbrowser ; webbrowser.open('http://localhost:$_TCP_PORT/debug?port=5858')" | |
node --debug-brk $@ | |
# I recommend putting this in your ~ or ~/scripts directory (however you organize your homedir) and aliasing it a la | |
# alias inspect="~/inspect.sh $@" | |
# Then you can run commands like this: | |
# inspect server.js --arg1 --arg2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment