node.jsnode-supervisor

Run node.js application in debug with supervisor


I am using supervisor to auto-reload my node.js, e.g.

supervisor -w . app.js

However I can't work out how to get supervisor to run the node.js process in debug, e.g. the equivalent to

node --debug app.coffee

Anyone got any ideas?


Solution

  • This solution will work for *nix:

    Go to /usr/local/bin or any other directory in your $PATH

    $ cd /usr/local/bin
    

    Create an executable script (say, node-debug) with the following contents

    #!/bin/bash
    node --debug $@
    

    To make it executable:

    $ sudo chmod 777 /usr/local/bin/node-debug
    

    Now you can run supervisor like this:

    $ supervisor -x node-debug script.js
    

    P.S.: To round it up:

    su
    echo '#!/bin/bash
    node --debug $@' > /usr/local/bin/node-debug
    chmod 777 /usr/local/bin/node-debug