Git Product home page Git Product logo

node-supervisor's Introduction

node-supervisor

A little supervisor script for nodejs. It runs your program, and watches for code changes, so you can have hot-code reloading-ish behavior, without worrying about memory leaks and making sure you clean up all the inter-module references, and without a whole new require system.

node-supervisor -?

Node Supervisor is used to restart programs when they crash.
It can also be used to restart programs when a *.js file changes.

Usage:
  supervisor [options] <program>
  supervisor [options] -- <program> [args ...]

Required:
  <program>
    The program to run.

Options:
  -w|--watch <watchItems>
    A comma-delimited list of folders or js files to watch for changes.
    When a change to a js file occurs, reload the program
    Default is '.'

  -i|--ignore <ignoreItems>
    A comma-delimited list of folders to ignore for changes.
    No default

  --ignore-symlinks
    Ignore symlinks :)
    
  -s|--timestamp
    Log timestamp after each run.
    Make it easy to tell when the task last ran.
    
  -p|--poll-interval <milliseconds>
    How often to poll watched files for changes.
    Defaults to Node default.

  -e|--extensions <extensions>
    A comma-delimited list of file extensions to watch for changes.
    Default is 'node,js' (or when CoffeeScript, 'node,js,coffee,litcoffee').

  -x|--exec <executable>
    The executable that runs the specified program.
    Default is 'node'

  -pid|--save-pid <path>
    Save supervisor's process id to a file at the given path.

  --debug[=port]
    Start node with --debug flag.

  --debug-brk[=port]
    Start node with --debug-brk flag.

  --harmony
    Start node with --harmony flag.

  --inspect[=port]
    Start node with --inspect flag.

  -n|--no-restart-on error|exit|success
    Don't automatically restart the supervised program if it ends.
    Supervisor will wait for a change in the source files.
    If "error", an exit code of 0 will still restart.
    If "exit", no restart regardless of exit code.
    If "success", no restart only if exit code is 0.

-t|--non-interactive
    Dissable interactive capacity
    With this option, supervisor won't listen to stdin

  --force-watch
    Use fs.watch instead of fs.watchFile.
    This may be useful if you see a high cpu load on a windows machine.

  -k|--instant-kill
    Instantly kills the server process, instead of gracefully shutting down the server.
	This can be useful when the node app has events attached to SIGTERM or SIGINT so as to do a graceful shutdown before the process exits.
	
 -RV|--restart-verbose
    Logs the file(s) that caused supervisor to restart

  -h|--help|-?
    Display these usage instructions.

  -q|--quiet
    Suppress DEBUG messages


Options available after start:
  rs - restart process. Useful when you want to restart your program even
       if no file has changed.


Examples:
  supervisor myapp.js
  supervisor myapp.coffee
  supervisor -w scripts -e myext -x myrunner myapp
  supervisor -w lib,server.js,config.js server.js
  supervisor -- server.js -h host -p port

In order to not watch for file changes, use "-i .".

Simple Install

Just run:

npm install supervisor -g

Fancy Install

Get this code, and then do this:

npm link

node-supervisor's People

Contributors

alallier avatar atourino avatar b-long avatar codelotus avatar coreyjewett avatar erasmospunk avatar fokkezb avatar heycalmdown avatar iangreenleaf avatar isaacs avatar javascipt avatar jazzzz avatar ktmud avatar mathieumg avatar maxlath avatar mikemaccana avatar mjseidel avatar mx1700 avatar owiber avatar paveltarno avatar petruisfan avatar re1ro avatar rentzsch avatar robwilkerson avatar romualdr avatar stonecobra avatar systemparadox avatar thomaschaaf avatar tswayne avatar ultravisual avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-supervisor's Issues

Coffee + --nodejs = uh oh!

supervisor -x node -- --debug server.js

works, but

supervisor -x coffee -- --nodejs --debug server.coffee

doesn't.

Image assets are not served properly

If I have a server.js file that contains something like:

app.use(express.static(path.join(__dirname, 'public'));

For some reason supervisor server.js doesn't allow image assets to be served.

E.g. <img src='/img/my-image.png' /> is not found.

Unsure why this happens, but when I do node server.js the images load perfectly fine.

Also, when I go to the full image path e.g. http://localhost:8080/img/my-image.png the asset loads perfectly fine.

I tested this across Firefox/Opera/Chrome just to make sure it wasn't a browser issue as well.

It would be interesting to hear your thoughts and/or how I can better debug this.

Slow Refresh Timer?

Hi,

I have node and supervisor installed on a VirtualBox for development. I'm running Ubuntu 11.04 with node 0.4.9.

When I run my app with supervisor and make a change to a file, it doesn't refresh right away. Sometimes it takes up to 10 seconds for the server to crash and refresh itself.

Should the server refresh the second I make a change? Or are my expectations wrong?

Multiple extensions are not watched

supervisor -e 'jade' -w 'views' src/server.coffee
works fine (when server.coffee or views/index.jade is edited, crash and restart server.coffee)

supervisor -e 'jade,css' -w 'views' src/server.coffee
only restarts when server.coffee is edited

supervisor -e 'jade,css' -w 'views,src/public/stylesheets' src/server.coffee
only restarts when server.coffee is edited

OSX 10.7, node 0.4.11, supervisor 0.1.3

sudo

I try to run this as sudo because I need sudo to start my server.
But it says
sudo: supervisor: command not found

How can I run the using sudo?

Thanks

Update version in npm repo

The version of supervisor in the npm repo needs to be updated (at some point). I've been using node v0.7.8 (unstable) and supervisor throws an error. This error isn't present after installing the supervisor from the git repo. This might not be a problem in node v0.6.x (i didn't test).

garrett@cb-linux:/dev/app$ node -v
v0.7.8
garrett@cb-linux:
/dev/app$ npm -v
1.1.16
garrett@cb-linux:~/dev/app$ supervisor app.js

node.js:256
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: The "sys" module is now called "util".
at sys.js:1:69
at NativeModule.compile (node.js:583:5)
at Function.require (node.js:551:18)
at Function._load (module.js:297:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object. (/home/garrett/local/lib/node_modules/supervisor/lib/supervisor.js:2:11)
at Module._compile (module.js:444:26)
at Object..js (module.js:462:10)
at Module.load (module.js:351:32)

change default to wait for file changes before restart

I think the default restart behavior should be to wait on file changes after a crash. During development a syntax error will cause an infinite loop of restarts. I recommend to change the default because I think development is the more common use case for this module versus deployment. If that is not the case, then obviously changing the default is wrong :)

program with arguments

how do you call a program with arguments, ie. rake build or

app.js -w param -e doda file1-argument.js

Faster change detection

I am monitoring a folder for change but it takes 4-5 sec from when I save a file til supervisor restarts the app.

Could the duration be shorter?

Problem w/ SVN?

I had noticed that I would get errors dealing with .svn/'s.
DEBUG: Error: Cannot find module '/www/web/me/nodejs/app/controllers/.svn'
at loadModule (node.js:275:15)
at require (node.js:411:14)
at /www/web/me/nodejs/lib/ni/ni.js:436:25
at /www/web/me/nodejs/lib/ni/ni.js:468:59
at Array.forEach (native)
at Function.readFiles (/www/web/me/nodejs/lib/ni/ni.js:464:31)
at next (/usr/lib/nodejs/.npm/step/0.0.3/package/lib/step.js:49:23)
at Step (/usr/lib/nodejs/.npm/step/0.0.3/package/lib/step.js:124:3)
at /www/web/me/nodejs/lib/ni/ni.js:459:13
at node.js:773:9

supervisor crashes, leaving node.js running

timers.js:103
            if (!process.listeners('uncaughtException').length) throw e;
                                                                      ^
Error: kill ESRCH
    at errnoException (node.js:278:13)
    at process.startup.processKillAndExit.process.kill (node.js:445:15)
    at Object._onTimeout (/usr/lib64/node_modules/supervisor/lib/supervisor.js:233:15)
    at Timer.list.ontimeout (timers.js:101:19)

supervisor -stop program.js?

I've been using Forever to keep my Node processes up — and one of the things I like about it is the ability to stop the process.
forever start blargh.js
forever list
[0] .... blargh.js
forever stop 0

However the ability to monitor code changes (what Supervisor does) seems more appealing. Would it be possible to get in a kill feature?

If this is a dumb idea please close and ignore :)

CPU spike for 2500 watched files in v0.8.8

When watching a large number of files (a bit more than 2500 in my specific case) with supervisor -e 'js|mu' app the CPU spikes to 60% on MBP 2.2Ghz. I repeated the same with forever --spinSleepTime 10 --watch --watchDirectory . start app.js and the CPU remained roughly at 0%.

Infinite loop when given bad module name

At startup, if you pass a filename that does not exist, supervisor will infinitely loop. Node.js throws an exception since it can't find the module and then Supervisor restarts the process because it crashed. This results in an infinite loop

CPU usage

supervisor app.js puts my CPU usage to 100%, on all 4 cores on windows 7.

node app.js runs fine.

Hello there! :)

I just want to thank you for the great supervisor, u've created...

I am very happy to now with supervisor, it works perfectly good and do all things

_It's just a very good _Node.JS* module, greetings!*

livereload trigger

I'm using livereload to watch for changes and reload browser pages automatically. If it reloads before supervisor has restarted, the old version is reloaded. There is a config.grace_period setting, but the restart times vary. Sometimes 5 seconds is enough. On other occasions 7 seconds is not enough. 8 seconds is so far getting a response, but apart from the question "why it's taking so long", we could tell livereload when the server is up - this could probably half the wait time for starters so it's not hardcoded to (the often unnecessary) that many seconds.

@fgnass suggested the following in the context of node-dev: "To play nicely with livereload it would probably be the best solution if node-dev talked directly to the browser-extension, just as the Ruby command-line tool does. The communication protocol is super simple, just some JSON over websockets. Using one of the numerous websocket modules for Node, it should be fairly easy to implement https://github.com/mockko/livereload/blob/master/server/lib/livereload.rb in JavaScript".

There is an easier way too. Perhaps node-dev could write a file "node.on" (option / configurable file name) with its contents the timestamp it last started / reloaded. Livereload can watch the *.on extension and reload whenever that file changes.

Either of these two would make a webdev workflow much easier...

Option to restart *only* on watched file changes?

Supervisor would be more versatile if there were a flag that prevented its default behavior of rerunning the target file every time the process ends. Perhaps -n/--norestart. That would be great for tests, e.g.

supervisor -w lib -n test/tests.js

Or should I use a different tool for this? (Or write my tests so that they stall indefinitely after running?)

broken in node v0.7

I accidentally updated to node v0.7

The first message node gives:

The "sys" module is now called "util". It should have a similar interface.

switching the require to use util instead doesn't solve the problem, it throws an error saying:

No program specified.

My initial report saying it was broken in v0.6.7 was premature, sorry about that.

DEBUG: crashing child

I get DEBUG: crashing child all the time in the console. Sometimes twice in a row. On a rare occasion, supervisor exits with:

DEBUG: crashing child

node.js:522
  process._kill(pid, lazyConstants()[sig]);
          ^
Error: Bad argument.
  at EventEmitter.kill (node.js:522:13)
  at StatWatcher.crash (/Users/orlinbozhinov/.node_libraries/.npm/supervisor/0.1.0/package/lib/supervisor.js:132:11)

Process started with `-x *.cmd` does not get killed on Windows

On Windows, supervisor -x coffee test.coffee does not work so one has to use supervisor -x coffee.cmd test.coffee. However, then one runs into the problem that killing the child process fails silently.

So, if for example the process is listening on a certain port, the newly created process fails to bind to that port again, because the old process is still running.

This also happens with common-node and other cases where a cmd wrapper script is used. The original report by @brettz9 is here: olegp/common-node#45

Easier API, more readable docs

I've never made a contribution to an open source project before, so please give me feedback.

I didn't find the readme/docs very readable, so I'm editing them as I see fit, while retaining the authors original content.

I also wondered why --no-restart-on error wouldn't be the default, so I'm planning on changing this API to a more user-friendly version where this is the default option, but you can pass an option --keep-restarting where the server will continually attempt to restart. I doubt most people want their console filled with a bunch of debugging messages flying by so fast they can't read them. Also adding a --no-restart-on-exit to retain the original no restart on exit functionality.

I was also annoyed with all the debugging messages, so I'm planning on changing the --quiet option to instead be the opposite --debug option to turn debugging on instead of having to turn it off. Un-necessary debug messages make it harder to spot real errors.

This is important to me because as I encourage those around me to use node, I'm also going to have to recommend this module. I want to help increase node adoption, so I feel these changes reflect a much nicer and user friendly api.

Warning on install

So, npm gives this warning when I run npm install supervisor:

npm WARN publish-everything [email protected] Adding entire directory to tarball. Please add a
npm WARN publish-everything [email protected] .npmignore or specify a 'files' array in the package.json

The install seems to work fine; I'd just like to know what the deal is. (Also, I notice that 0.1.2 isn't a version tag in the repo...)

extensions filter ignored

Every file change seems to take, regardless of the extension (even when I only specify js as an extension)

Error: No program specified

running on node v0.6.1-pre

I get this error:

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: No program specified.
at Object.run (/usr/local/lib/node_modules/supervisor/lib/supervisor.js:25:11)
at Object. (/usr/local/lib/node_modules/supervisor/lib/cli-wrapper.js:11:25)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)

cannot find node binary on reboot

I have a reboot script that was using supervisor to start my node app. and it choked when it tried to start it...

/usr/sbin/env | node -- cannot find node

This was on debian from an /etc/init.d/ script that executed supervisor app.js.

supervisor -- server.js --debug

to make command below work:

supervisor -- server.js --debug

line 145 of lib/supervisor.js should be

  var spawnme = args ? args.concat([prog]) : [prog];

or the spawned child process will be node server.js --debug, and the --debug will be ignored by node.js.

error "No such module" in windows

supervisor node_server.js

I got this error , how to fix it ?

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: No such module
    at EventEmitter.<anonymous> (node.js:381:27)
    at C:\Program Files\nodejs\node_modules\supervisor\lib\supervisor.js:66:13
    at Array.forEach (native)
    at Object.run (C:\Program Files\nodejs\node_modules\supervisor\lib\supervisor.js:65:48)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\supervisor\lib\cli-wrapper.js:13:25)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)

Officially compatable Node v0.2.5?

Is this officially compatable with node Node v0.2.5?

I tried installing with npm. It wouldn't do it because of "~0.2.3 || ~0.3". Appologies if this is by design and correct.

Anyway, I installed via the source using npm link and all is working... or is this dangerous?

Thanks
Ross

Option to exclude directories too

Great work on node-supervisor. We use it during development, and it's generally pretty convenient, except for those times when we're working mainly on client-side scripts. Then, it's downright annoying as it restarts the server on every minor change to client-side scripts.

It would thus be really convenient if we could tell node-supervisor, "yes, watch this entire tree, but ignore changes to this directory". =) Would love to hear what you think, and thanks in advance!

-n|--no-restart-on error|exit <<< does not work

Hi!

First, thanks for a great tool!

Now, with a simple script such as:

require("./lib/sub.js");
console.log("main loaded!");

sub.js

console.log("sub loaded!");

The above "-n" does restart the app.

supervisor on Windows 7

I have trouble running supervisor on Windows 7. The command:

node %NODE_PATH%\supervisor\lib\cli-wrapper.js app.js

And output:

The "sys" module is now called "util". It should have a similar interface.

DEBUG: Running node-supervisor with
DEBUG: program 'app.js'
DEBUG: --watch '.'
DEBUG: --extensions 'node|js'
DEBUG: --exec 'node'

DEBUG: Starting child process with 'node app.js'
DEBUG: Watching directory 'C:...\tests\express-server/.' for changes.

fs.js:694
throw new Error('use fs.watch api instead');
^
Error: use fs.watch api instead
at Object.watchFile (fs.js:694:11)
at watchGivenFile (C:...\node_modules\supervisor\lib\supervisor.js:142:6)
at Object.oncomplete (C:...\node_modules\supervisor\lib\supervisor.js:163:11)

Any suggestions?

Thanks,
Jani

npm install supervisor, No such file or directory

There is no build directory below package:

ls /usr/local/lib/node/.npm/supervisor/0.0.3/package

configure  lib  Makefile  Makefile.src  package.json  README.md  src

error log:
npm configfile /root/.npmrc
npm sudo true
npm cli [ 'install', 'supervisor' ]
npm version 0.1.16
npm install pkg supervisor
npm fetch data supervisor
npm GET supervisor
npm install pkg supervisor
npm install pkg [email protected]
npm readJson /usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package.json
npm GET supervisor/0.0.3
npm fetch http://github.com/isaacs/node-supervisor/tarball/v0.0.3 to /usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package.tgz
npm fetch 302 http://waitdownload.github.com/isaacs-node-supervisor-v0.0.3-0-g5b9b075.tar.gz
npm fetch 302 http://download.github.com/isaacs-node-supervisor-v0.0.3-0-g5b9b075.tar.gz
npm content-length 2785
npm downloaded 100%
npm fetch finished
npm bytes 2785
npm exec tar "xzf" "/usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package.tgz" "--strip" "1" "-C" "/usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package"
npm readJson /usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package/package.json
npm testEngine required: node ">=0.1.90"
npm buildAll About to unpack
npm unpack [ 'supervisor', '0.0.3' ]
npm exec tar "xzf" "/usr/local/lib/node/.npm/.cache/supervisor/0.0.3/package.tgz" "--strip" "1" "-C" "/usr/local/lib/node/.npm/supervisor/0.0.3/package"
npm build /usr/local/lib/node/.npm/supervisor/0.0.3/package
npm readJson /usr/local/lib/node/.npm/supervisor/0.0.3/package/package.json
npm testEngine required: node ">=0.1.90"
npm lifecycle supervisor-0.0.3 preinstall
npm exec ./configure
npm createMain lib/supervisor
npm linkMain supervisor-0.0.3
npm linkLib supervisor-0.0.3
npm linkBins supervisor-0.0.3
npm linkBin node-supervisor ./build/node-supervisor
npm linkBins failed

npm ! Error: ENOENT, No such file or directory '/usr/local/lib/node/.npm/supervisor/0.0.3/package/build/node-supervisor'
at node.js:221:9

Integration with Chef?

Hi there, first of all supervisor rocks - thanks so much. My situation is a bit edgy, I know, but I'm hoping you can give me some clue as to what to try here. I have a Vagrant setup that spins up a VM and installs Node and all the dependencies, then starts node using upstart.

I want to update chef to actually use supervisor instead, so that the node process will reload changed files on the fly. The problem is that I've not been able to find a way to get chef to start supervisor without abandoning it, which then orphans the node process. Have you tried getting supervisor to work with chef or puppet yet? Thanks for your help!

does not work with cluster

node 0.6.4, supervisor 0.2.0, Darwin 11.2.0

A node.js application that creates child processes with the built-in cluster functionality does not restart when the main application file changes. The same works fine without cluster.

Supervisor prints out "DEBUG: crashing" but the node processes do not seem to be terminated.

API

Could an API be released so we could programmatically use Supervisor in our programs to run whatever logic we want?

Idea: watch only require()'d files

We suffer a lot from false positives -- node-supervisor detecting a file change and restarting the web server, even though that restart was technically unnecessary.

We also get false negatives: when we change code in a component we use and have linked through npm link, but that code isn't in the current tree, so node-supervisor doesn't pick it up.

I've filed request #18 for directory exclusion which will help with the false positives, but in general, I've been thinking that one way to solve both of these entirely would be if node-supervisor could be made aware of which files were actually require()-d, and watch only those.

Since node-supervisor runs in a separate process, it can't know this directly, but it can with a little help from the program itself. I was thinking the program could, at the very beginning, require() a helper script that registers its watch extensions with require(), and watches every file that's required.

E.g. if I normally run node app.js, I might add this to the top of my app.js:

require('supervisor');

And the supervisor module would have logic like this, except repeated for each extension that's being watched (which may mean that this module should be required after e.g. requiring CoffeeScript):

var origRequireExtensions = {};

origRequireExtensions['.js'] = require.extensions['.js'];
require.extensions['.js'] = function (module, filename) {
    // [code goes here: add this file to the watch list; i.e. start watching it too.]
    // then load it like normal:
    origRequireExtensions['.js'](module, filename);
};

This would allow you to run node-supervisor app.js exactly like node app.js. I noticed this goal is already on your TODO ist as #6. =)

An open issue is what this helper script should do if a watched file changes, i.e. how it should communicate that to the actual supervisor process.

An easy initial answer is that the helper script can just end the running node process via process.exit(), and the supervisor script would then restart it like normal.

Not sure if there are better ways though, particularly since we've noticed that often, while we're actually typing and pressing ctrl+s, we don't necessarily want or need node-supervisor to restart the server, since the code may not compile, which may just lead to repeated crashes.

Anyway, this is the extent to which I've fleshed out this idea so far. What are your thoughts? Sound reasonable, or am I missing something important? Thanks in advance!

Restarting before file changes are complete

I run node through a SSH connection to my web server, and FTP upload file updates.
The issue is that most of the time, supervisor will restart node before the file is finished uploading.
It's not a huge deal, but it does make it more difficult to look at debugging information from before it was restarted, and it prevents me from using no-restart-on errors.

It would be nice to have a check that the file has stopped changing.
Or to be able to configure a delay before restarting node after detecting a change.

Stop restarting on crashing code

I have been using Supervisor for development, and it irks me that if I make a syntax error or something else that will make Node crash immediately when launched, Supervisor will just continue to restart the process, several times a second.

Wouldn't it be a safe assumption that a process that dies within its first second of runtime should not be restarted?

Incompatibility with Forever?

Attempting to use with forever:

sudo supervisor -x forever index.js

Any restart triggered by supervisor on filechange will net the following response / error:

Error: EADDRINUSE, Address already in use
    at Server._doListen (net.js:1100:5)
    at net.js:1071:14
    at Object.lookup (dns.js:159:5)
    at Server.listen (net.js:1065:20)
    ...

Error in Windows

I have this error on launch:

D:\Documents\Projects\chat>supervisor server.js

DEBUG: Running node-supervisor with
DEBUG: program 'server.js'
DEBUG: --watch '.'
DEBUG: --extensions 'node|js'
DEBUG: --exec 'node'

DEBUG: Starting child process with 'node server.js'
DEBUG: Watching directory 'D:\Documents\Projects\chat/.' for changes.

C:\Users\Vavon\AppData\Roaming\npm\node_modules\supervisor\lib\supervisor.js:203
fs.watch(watch, { persistent: true, interval: poll_interval }, crashWin);
^
TypeError: Object # has no method 'watch'
at watchGivenFile (C:\Users\Vavon\AppData\Roaming\npm\node_modules\supervisor\lib\supervisor.js:203:8)
at C:\Users\Vavon\AppData\Roaming\npm\node_modules\supervisor\lib\supervisor.js:90:7
at Object.oncomplete (C:\Users\Vavon\AppData\Roaming\npm\node_modules\supervisor\lib\supervisor.js:213:7)

I`m using Win 7 x64.

Arguments are passed incorrectly when using coffee script

Hi,

there's the following code in supervisor.js#155:

var spawnme = args ? [prog].concat(args) : [prog];

The issue with it is that coffee script expects options first and then script name:

$ coffee --help
Usage: coffee [options] path/to/script.coffee

while the code above provides script name first (prog) and then options (args).

Changing the line above to:

var spawnme = args ? args.concat[prog] : [prog];

solves the issue and allows to run node js with debugger enabled like this:

supervisor -- app.coffee --nodejs --debug

If the order in which script name and arguments should be passed depends on executable, maybe it would be possible to add an option for that (e.g. --options-first), which for coffee would be set by default.

I can write a patch for that if anybody else thinks it's a good idea :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.