Created
August 28, 2012 01:07
-
-
Save donpark/3494038 to your computer and use it in GitHub Desktop.
fabric/python script for launching node-inspector
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
import os | |
import time | |
def terminal(cmd): | |
local("osascript -e 'tell application \"Terminal\" to do script \"%s\"'" % cmd) | |
def debugger(opts): | |
url = "http://0.0.0.0:8080/debug?port=5858" | |
build() | |
terminal("node %(opts)s %(cwd)s/app.js" % { "opts": opts, "cwd": os.getcwd() }) | |
time.sleep(1) | |
terminal("node-inspector") | |
time.sleep(1) | |
local("open -a Safari %s" % url) | |
def debug(): | |
debugger("--debug") | |
def debugbreak(): | |
debugger("--debug-brk") |
Using Fabric, fab debug
command will:
- open a new Terminal window to run the app in debug mode
- open another Terminal window to run
node-inspector
- open Safari (better debugger UI) to
node-inspector
.
Adjust first time.sleep
delay as needed if your app takes longer to start.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What I use to start debugging node.js app on OS X using
node-inspector
.I'll eventually port this to node.js but is provided here as-is for now.
main file is assumed to be
app.js
.