gruntjs / grunt-contrib-watch

Run tasks whenever watched files change.
http://gruntjs.com/
MIT License
1.98k stars 356 forks source link

Opening any watched file on OSX High Sierra triggers watch task. #552

Closed NoelBaron closed 6 years ago

NoelBaron commented 6 years ago

Watch tasks are triggering any time I open a file in my IDE. I'm using CODA 2 (PANIC), with the following:


{
 "grunt": "^0.4.5",
 "grunt-contrib-less": "^1.2.0",
 "grunt-contrib-uglify": "^1.0.0",
 "grunt-contrib-watch": "^0.6.1",
 "grunt-env": "^0.4.4",
 "grunt-express-server": "^0.5.3"
}
NoelBaron commented 6 years ago

I tried opening a file in three different editors (including Text Edit). Each time the file was opened, watch task triggered as if the file changed. Any ideas?

NoelBaron commented 6 years ago

Same problem with these versions:


"devDependencies": {
    "grunt": "^1.0.2",
    "grunt-contrib-less": "^1.4.1",
    "grunt-contrib-uglify": "^3.3.0",
    "grunt-contrib-watch": "^1.0.0",
    "grunt-env": "^0.4.4",
    "grunt-express-server": "^0.5.3"
  }
shama commented 6 years ago

See the comment here: https://github.com/gruntjs/grunt/issues/1626#issuecomment-368932870

I bet it's creating lock files that the watch task is listening to. As this task only gets an event if a file is added, changed or deleted. I can't detect when files are opened by an IDE/text editor.

NoelBaron commented 6 years ago

@shama This is what I see. I'm using */.js patterns.

screen shot of events

NoelBaron commented 6 years ago

That one happens when the IDE opens with files already listed. It also happens if TextEdit opens the file, or any other application. I'm thinking maybe its a .DS_Store file or something OSX specific, but I can't nail it down :(

@shama

NoelBaron commented 6 years ago

@shama Can we reopen this? I asked on Stack Overflow and we agree it looks like this is happening on High Sierra. Were you able to test for this bug on High Sierra?

shama commented 6 years ago

I'm on high sierra. I don't consider this a bug with grunt-contrib-watch but if you can provide a repro that shows it is in fact a bug with this task I'll reopen.

This isn't something I can debug for you. It's highly likely your editor and/or environment. Maybe dropbox is running or some other process on your machine that is touching files. I'm not sure, it doesn't happen for me.