coffee --watch doesn't work reliably #2269

Closed
scribu opened this Issue Apr 17, 2012 · 7 comments

Projects

None yet

3 participants

@scribu

When I call coffee -w -o js -c coffee/, or even for a single file, I have to save it at least two times to trigger a recompilation.

My environment: Ubuntu 11.10, node 0.6.15, CoffeeScript 1.3.1, vim editor

I've seen #1853, but figure a new issue is more appropriate, since I've read there were several changes in this area since then.

@scribu

Also, sometimes, after a save, coffee says the file was removed, instead of recompiling it.

@TrevorBurnham
Collaborator

@scottcorgan That sounds like a different issue than @scribu is experiencing. In particular, it's a bug at the Node.js level, which you should try to isolate and report. (Try updating Node to the latest 0.6.x release first.)

@TrevorBurnham
Collaborator

@scribu This is most likely yet another quirk of Node's fs.watch. Try this: Launch the coffee REPL and run

> fs = require 'fs'
> fs.watch 'coffee/yourfile.coffee', -> console.log (+new Date), arguments

then tell me what output you get when you save changes to the file.

@scribu

First file edit: nothing.
Second file edit:

1335280930608 { '0': 'change', '1': 'core.coffee' }
1335280930610 { '0': 'rename', '1': 'core.coffee' }
1335280930610 { '0': 'rename', '1': 'core.coffee' }

Subsequent edits: nothing.

@TrevorBurnham
Collaborator

So it's definitely a bug in fs.watch, then. Please report it at https://github.com/joyent/node/issues/

By the way, as a workaround you can use https://github.com/trevorburnham/jitter, which uses the older and more reliable (though less efficient) fs.watchFile.

@michaelficarra
Collaborator

@scribu: If you make a new node issue, post a link here.

@scribu

Yep, Jitter seems to work fine. Thanks!

Opened an issue: nodejs/node-v0.x-archive#3172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment