How can I stop Atom from touching a file on disk when I click into it?


#1

I have nodemon monitoring all my js files for hot-reload.

I am finding that every time I click into a buffer of a file, it triggers nodemon!

Even if the buffer is unmodified.

This is really painful - sometimes nodemon can be fired twice in quick succession, the second reload even before the first one finishes, which makes a mess of the trace.

How can I tell Atom that I will decide when I want the file saved?

(To me, it feels like a bug updating the mtime on a file when it hasn’t even changed!)


#2

Have you followed the suggestions in the Debugging document? Also, could you give the following information?

  • Which version of Atom are you using? (Please give the exact version number. At any one time, there are three different “latest versions” of Atom.)
  • What OS and version are you running?
  • Can you reproduce the issue after completely exiting Atom and restarting using atom --safe?

#3

Thanks for the tips!

While I wrote “it feels like a bug”, I was actually enquiring whether it’s a feature that I can turn off.

I take it from your response that it’s more likely a bug, so I will go through the “debugging” process.

Cheers,

Martin


#4

Atom version: 1.12.6

OSX 10.11.6

Same thing happens under atom --safe


#5

That’s very strange because I can’t replicate what you’re describing. Here’s what I did:

  1. Launch Atom in my local copy of the Atom repository
  2. Open a Terminal window and change directory to my local Atom repository
  3. Enter stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" README.md in the Terminal window to get the last modified time of the README.md (it is 2016-11-12 08:14:19)
  4. Single-click README.md in the Tree View to open it in preview mode
  5. Enter the stat command again (output is still 2016-11-12 08:14:19)
  6. Double-click README.md in the Tree View to open it in non-preview mode
  7. Enter the stat command again (output is still 2016-11-12 08:14:19)

At no time did the modified time of the file change simply by opening the file. I replicated this using Atom v1.12.6 on Mac OS X 10.12.1. There must be something going on with your machine or configuration that is doing it.


#6

Thanks for looking into it.

It seems I have been caught out by an assumption.

First to clarify though - when I said “click into” I meant "place the cursor in that buffer when it was in a diffent one. I have two panes open. Obviously I should have said so,

However, I tried again this time looking at stat and I find that the mtime of the files is not changing.

This means that atom must be doing something else causing nodemon to trigger. I don’t know what that is yet, but at least you straightened out the wrong assumption that because it was triggering, the file I clicked into must have changed!


#7

Well, really weird.

Below you will see that I

  • stated Identity.js,
  • ran nodemon
  • clicked into Identity.js
  • stopped nodemon and re-stated Idenity.js

Nodemon says it saw Identity.js change.

stat says the mtime hasn’t changed.

Any clues appreciated:

~/NRN/src/agreeonit/apollo_server$ stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" dao/Identity.js 
2016-12-02 17:45:10
~/NRN/src/agreeonit/apollo_server$ npm run dao-test

> apollo_aoi_server@1.0.0 dao-test /Users/mgregory/NRN/src/agreeonit/apollo_server
> nodemon --debug --verbose --exec npm run babel-node -- dao/test.js

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] watching extensions: js,json
[nodemon] starting `npm --debug run babel-node dao/test.js`
[nodemon] child pid: 31359
[nodemon] watching 43 files

> apollo_aoi_server@1.0.0 babel-node /Users/mgregory/NRN/src/agreeonit/apollo_server
> babel-node --presets=es2015 "dao/test.js"

project 0 id 2

[nodemon] files triggering change check: dao/Identity.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] dao/Identity.js

[nodemon] starting `npm --debug run babel-node dao/test.js`
[nodemon] child pid: 31373

> apollo_aoi_server@1.0.0 babel-node /Users/mgregory/NRN/src/agreeonit/apollo_server
> babel-node --presets=es2015 "dao/test.js"

project 0 id 2

^C
[nodemon] exiting
~/NRN/src/agreeonit/apollo_server$ stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" dao/Identity.js 
2016-12-02 17:45:10
~/NRN/src/agreeonit/apollo_server$

#8

OK, so the atime is changing.

Dang - that seems likea nodemon bug, not an atom bug :slight_smile:

Thanks again for your help.


#9

That does sound pretty frustrating. I’m glad you were able to get things figured out though :grinning: