File change watcher is not working in TextMate2 on Mac #1053

Closed
hgfischer opened this Issue Apr 6, 2015 · 45 comments

Comments

Projects
None yet
@hgfischer

File watching in the current master version is broken in Mac, but not on Linux. Hugo looks to detect only the first change. Another sub-sequential changes are not detected.

I also had to checkout the 967d001ebe40cfe90992d953880356a495216202 version instead of the v0.13 tag because the v0.13 cannot be built.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 6, 2015

Member

I would be very surprised if this was true - as the core Hugo devs are mostly hugging their pretty Macs. I'm Linux.

Can you confirm this @mdhender ?

Member

bep commented Apr 6, 2015

I would be very surprised if this was true - as the core Hugo devs are mostly hugging their pretty Macs. I'm Linux.

Can you confirm this @mdhender ?

@mdhender

This comment has been minimized.

Show comment
Hide comment
@mdhender

mdhender Apr 6, 2015

Contributor

I'm not having any issues with the current master recognizing multiple changes:

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

$ go build

$ go install

$ hugo version
Hugo Static Site Generator v0.14-DEV BuildDate: 2015-04-06T15:32:57-05:00

$ cd ~/Data/Sites/n608/

$ hugo server -w
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms
Watching for changes in /Users/test/Data/Sites/n608/{data,content,layouts,static,themes/l}
Serving pages from /Users/test/Data/Sites/n608/public
Web Server is available at http://localhost:1313/
Press Ctrl+C to stop

Change detected, rebuilding site
2015-04-06 15:36 -0500
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms

Change detected, rebuilding site
2015-04-06 15:36 -0500
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms
Contributor

mdhender commented Apr 6, 2015

I'm not having any issues with the current master recognizing multiple changes:

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

$ go build

$ go install

$ hugo version
Hugo Static Site Generator v0.14-DEV BuildDate: 2015-04-06T15:32:57-05:00

$ cd ~/Data/Sites/n608/

$ hugo server -w
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms
Watching for changes in /Users/test/Data/Sites/n608/{data,content,layouts,static,themes/l}
Serving pages from /Users/test/Data/Sites/n608/public
Web Server is available at http://localhost:1313/
Press Ctrl+C to stop

Change detected, rebuilding site
2015-04-06 15:36 -0500
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms

Change detected, rebuilding site
2015-04-06 15:36 -0500
0 draft content
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 6 ms
@hgfischer

This comment has been minimized.

Show comment
Hide comment
@hgfischer

hgfischer Apr 6, 2015

The Mac issue was observed in the computer of @reginaldosousa. Maybe he can give more detail about his Mac.

We tested many times, and got the same behavior even after resetting the entire GOPATH (bin, pkg and src).

The Mac issue was observed in the computer of @reginaldosousa. Maybe he can give more detail about his Mac.

We tested many times, and got the same behavior even after resetting the entire GOPATH (bin, pkg and src).

@mdhender

This comment has been minimized.

Show comment
Hide comment
@mdhender

mdhender Apr 6, 2015

Contributor

It looks like there is an outdated dependency for the v0.13 tag.

$ git checkout v0.13
Note: checking out 'v0.13'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at e43eaba... Updating the final release notes for v0.13

$ git status
HEAD detached at v0.13
nothing to commit, working directory clean

$ go get
package bitbucket.org/kardianos/osext
    imports bitbucket.org/kardianos/osext
    imports bitbucket.org/kardianos/osext: code in directory /Users/Guest/go/src/bitbucket.org/kardianos/osext expects import "github.com/kardianos/osext"

$ go build
commands/version.go:23:2: code in directory /Users/Guest/go/src/bitbucket.org/kardianos/osext expects import "github.com/kardianos/osext"

$ go get -u
package github.com/spf13/hugo: github.com/spf13/hugo is a custom import path for https://github.com/spf13/hugo, but /Users/Guest/go/src/github.com/spf13/hugo is checked out from https://github.com/spf13/hugo.git
Contributor

mdhender commented Apr 6, 2015

It looks like there is an outdated dependency for the v0.13 tag.

$ git checkout v0.13
Note: checking out 'v0.13'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at e43eaba... Updating the final release notes for v0.13

$ git status
HEAD detached at v0.13
nothing to commit, working directory clean

$ go get
package bitbucket.org/kardianos/osext
    imports bitbucket.org/kardianos/osext
    imports bitbucket.org/kardianos/osext: code in directory /Users/Guest/go/src/bitbucket.org/kardianos/osext expects import "github.com/kardianos/osext"

$ go build
commands/version.go:23:2: code in directory /Users/Guest/go/src/bitbucket.org/kardianos/osext expects import "github.com/kardianos/osext"

$ go get -u
package github.com/spf13/hugo: github.com/spf13/hugo is a custom import path for https://github.com/spf13/hugo, but /Users/Guest/go/src/github.com/spf13/hugo is checked out from https://github.com/spf13/hugo.git
@mdhender

This comment has been minimized.

Show comment
Hide comment
@mdhender

mdhender Apr 6, 2015

Contributor

FWIW:

$ uname -a
Darwin Michaels-Mac-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
$ go version
go version go1.4.2 darwin/amd64
Contributor

mdhender commented Apr 6, 2015

FWIW:

$ uname -a
Darwin Michaels-Mac-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
$ go version
go version go1.4.2 darwin/amd64
@hgfischer

This comment has been minimized.

Show comment
Hide comment
@hgfischer

hgfischer Apr 6, 2015

Yes @mdhender. That is why I had to checkout 967d001 to be able to build something that resembles v0.13, which works well in Mac.

Yes @mdhender. That is why I had to checkout 967d001 to be able to build something that resembles v0.13, which works well in Mac.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 6, 2015

Member

There are (big) rooms for improvements in the Go packaging world. So, if you build v0.13 now (if it had built successful), you will not get the same binary now compared to when it was released (because third partiy deps have changed).

So I would either:

  1. Use brew (that I now think has the source dependencies sorted out)
  2. Download the binary
  3. Use the latest master
Member

bep commented Apr 6, 2015

There are (big) rooms for improvements in the Go packaging world. So, if you build v0.13 now (if it had built successful), you will not get the same binary now compared to when it was released (because third partiy deps have changed).

So I would either:

  1. Use brew (that I now think has the source dependencies sorted out)
  2. Download the binary
  3. Use the latest master
@hgfischer

This comment has been minimized.

Show comment
Hide comment
@hgfischer

hgfischer Apr 6, 2015

@bep If you start over with a clean GOPATH, are you able to successfully build v0.13?

  1. The current brew formula does exactly what is needed to fix the v0.13 release before building it. It applies a patch to do the same thing that 967d001 does: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/hugo.rb

  2. This is OK, but not feasible in my use case. I have to support more than one platform environment and the go tool should be sufficient to install Hugo without issues.

  3. The latest master appears to have a bug, as was previously reported in this issue.

We should not create other ways to build/install things that are made in Go. The go tooling is sufficient enough for building and installing things. IMHO it is nice to have a Brew formula to install a binary or maybe install Go and use it to build Hugo, but applying a patch just because the v0.13 release got wrong, is a smell for me.

In this case, I suggest creating a v0.13.1 release with the proper fix.

@bep If you start over with a clean GOPATH, are you able to successfully build v0.13?

  1. The current brew formula does exactly what is needed to fix the v0.13 release before building it. It applies a patch to do the same thing that 967d001 does: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/hugo.rb

  2. This is OK, but not feasible in my use case. I have to support more than one platform environment and the go tool should be sufficient to install Hugo without issues.

  3. The latest master appears to have a bug, as was previously reported in this issue.

We should not create other ways to build/install things that are made in Go. The go tooling is sufficient enough for building and installing things. IMHO it is nice to have a Brew formula to install a binary or maybe install Go and use it to build Hugo, but applying a patch just because the v0.13 release got wrong, is a smell for me.

In this case, I suggest creating a v0.13.1 release with the proper fix.

@reginaldosousa

This comment has been minimized.

Show comment
Hide comment
@reginaldosousa

reginaldosousa Apr 6, 2015

$ uname -a
Darwin Mac-81.local 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
$ go version
go version go1.4.2 darwin/amd64
$ uname -a
Darwin Mac-81.local 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST 2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
$ go version
go version go1.4.2 darwin/amd64
@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Apr 6, 2015

Member

For "bulding from a release tag" to be a success, we need to have a source release process that also includes thirdparty deps. I see discussion about a formal improvements of the current situation at go-nuts/go-dev mailing list, but it's not an easy task and not something that can be solved by Hugo alone.

@spf13 is the man to talk to about releases.

Member

bep commented Apr 6, 2015

For "bulding from a release tag" to be a success, we need to have a source release process that also includes thirdparty deps. I see discussion about a formal improvements of the current situation at go-nuts/go-dev mailing list, but it's not an easy task and not something that can be solved by Hugo alone.

@spf13 is the man to talk to about releases.

@mdhender

This comment has been minimized.

Show comment
Hide comment
@mdhender

mdhender Apr 7, 2015

Contributor

I know that "v014-DEV build works on my Mac" isn't the answer that you're looking for, but it does. The only time I've had problems with the watch stopping were when there were errors in the templates. Sometimes the errors cause me to have to restart the server.

Contributor

mdhender commented Apr 7, 2015

I know that "v014-DEV build works on my Mac" isn't the answer that you're looking for, but it does. The only time I've had problems with the watch stopping were when there were errors in the templates. Sometimes the errors cause me to have to restart the server.

@hgfischer

This comment has been minimized.

Show comment
Hide comment
@hgfischer

hgfischer Apr 7, 2015

Our templates does not have errors, nor warnings. At least Hugo is not complaining. If is there some way to debug this, maybe we (me and @reginaldosousa) could help fix the issue, but we need help to debug it.

Our templates does not have errors, nor warnings. At least Hugo is not complaining. If is there some way to debug this, maybe we (me and @reginaldosousa) could help fix the issue, but we need help to debug it.

@mdhender

This comment has been minimized.

Show comment
Hide comment
@mdhender

mdhender Apr 7, 2015

Contributor

Can you share the template? I have time this afternoon to run on my Mac to see if I can duplicate the issue. That would be a first step.

Contributor

mdhender commented Apr 7, 2015

Can you share the template? I have time this afternoon to run on my Mac to see if I can duplicate the issue. That would be a first step.

@hgfischer

This comment has been minimized.

Show comment
Hide comment
@hgfischer

hgfischer Apr 25, 2015

It is based on the original Hugo docs template, extracted from it's own source repository.

It is based on the original Hugo docs template, extracted from it's own source repository.

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt May 28, 2015

Installed via homebrew

Hugo Static Site Generator v0.14 BuildDate: 2015-05-26T18:46:46+02:00

and have the same problem.

I am running hugo server -w --theme=html5 --buildDrafts and it does not very consistently respond to file changes.

Especially when changing and saving the same file twice.
It's almost as if it only triggers on the first change per file.

tcurdt commented May 28, 2015

Installed via homebrew

Hugo Static Site Generator v0.14 BuildDate: 2015-05-26T18:46:46+02:00

and have the same problem.

I am running hugo server -w --theme=html5 --buildDrafts and it does not very consistently respond to file changes.

Especially when changing and saving the same file twice.
It's almost as if it only triggers on the first change per file.

@dunn

This comment has been minimized.

Show comment
Hide comment
@dunn

dunn May 28, 2015

Contributor

I can't replicate that on 10.10.3, with Hugo 0.14 also installed via brew.

Contributor

dunn commented May 28, 2015

I can't replicate that on 10.10.3, with Hugo 0.14 also installed via brew.

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt May 28, 2015

Odd. I am also on 10.10.3.

tcurdt commented May 28, 2015

Odd. I am also on 10.10.3.

@dunn

This comment has been minimized.

Show comment
Hide comment
@dunn

dunn May 28, 2015

Contributor

If you run it with --verbose, is there any output after the first reload?

Contributor

dunn commented May 28, 2015

If you run it with --verbose, is there any output after the first reload?

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt May 29, 2015

$ hugo server -w --verbose --theme=html5 --buildDrafts
INFO: 2015/05/29 Using config file: /Users/tcurdt/Downloads/hugo-test/config.toml
INFO: 2015/05/29 syncing from /Users/tcurdt/Downloads/hugo-test/themes/html5/static to /Users/tcurdt/Downloads/hugo-test/public/
INFO: 2015/05/29 syncing from /Users/tcurdt/Downloads/hugo-test/static/ to /Users/tcurdt/Downloads/hugo-test/public/
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
ERROR: 2015/05/29 Site's .BaseUrl is deprecated and will be removed in Hugo 0.15. Use .BaseURL instead.
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 12 ms
Watching for changes in /Users/tcurdt/Downloads/hugo-test/{data,content,layouts,static,themes/html5}
Serving pages from /Users/tcurdt/Downloads/hugo-test/public
Web Server is available at http://127.0.0.1:1313/
Press Ctrl+C to stop

<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
INFO: 2015/05/29 File System Event: ["/Users/tcurdt/Downloads/hugo-test/content/about.md": CHMOD "/Users/tcurdt/Downloads/hugo-test/content/about.md": REMOVE]

Change detected, rebuilding site
2015-05-29 02:56 +0200
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 categories created
0 tags created
in 14 ms

<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
<save /Users/tcurdt/Downloads/hugo-test/content/about.md>

<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
INFO: 2015/05/29 File System Event: ["/Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md": CHMOD "/Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md": REMOVE]

Change detected, rebuilding site
2015-05-29 02:59 +0200
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 19 ms

<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>

tcurdt commented May 29, 2015

$ hugo server -w --verbose --theme=html5 --buildDrafts
INFO: 2015/05/29 Using config file: /Users/tcurdt/Downloads/hugo-test/config.toml
INFO: 2015/05/29 syncing from /Users/tcurdt/Downloads/hugo-test/themes/html5/static to /Users/tcurdt/Downloads/hugo-test/public/
INFO: 2015/05/29 syncing from /Users/tcurdt/Downloads/hugo-test/static/ to /Users/tcurdt/Downloads/hugo-test/public/
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
ERROR: 2015/05/29 Site's .BaseUrl is deprecated and will be removed in Hugo 0.15. Use .BaseURL instead.
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 12 ms
Watching for changes in /Users/tcurdt/Downloads/hugo-test/{data,content,layouts,static,themes/html5}
Serving pages from /Users/tcurdt/Downloads/hugo-test/public
Web Server is available at http://127.0.0.1:1313/
Press Ctrl+C to stop

<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
INFO: 2015/05/29 File System Event: ["/Users/tcurdt/Downloads/hugo-test/content/about.md": CHMOD "/Users/tcurdt/Downloads/hugo-test/content/about.md": REMOVE]

Change detected, rebuilding site
2015-05-29 02:56 +0200
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 categories created
0 tags created
in 14 ms

<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
<save /Users/tcurdt/Downloads/hugo-test/content/about.md>
<save /Users/tcurdt/Downloads/hugo-test/content/about.md>

<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
INFO: 2015/05/29 File System Event: ["/Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md": CHMOD "/Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md": REMOVE]

Change detected, rebuilding site
2015-05-29 02:59 +0200
INFO: 2015/05/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2015/05/29 Unable to locate layout for 404 page: [404.html theme/404.html]
2 of 2 drafts rendered
0 future content 
2 pages created
0 paginator pages created
0 tags created
0 categories created
in 19 ms

<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
<save /Users/tcurdt/Downloads/hugo-test/content/post/2015-test-test/index.md>
@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 28, 2015

Member

@tcurdt are you still having this issue?

The thing is, I'm running OSX now -- and having this exactly issue.

See #1236

Member

bep commented Jun 28, 2015

@tcurdt are you still having this issue?

The thing is, I'm running OSX now -- and having this exactly issue.

See #1236

@bep bep added the Bug label Jun 28, 2015

@bep bep added this to the v0.15 milestone Jun 28, 2015

@bep bep self-assigned this Jun 28, 2015

@tcurdt

This comment has been minimized.

Show comment
Hide comment

tcurdt commented Jun 28, 2015

@bep yupp!

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 28, 2015

Member

The good thing is, I do not give up easily.

I have found a pattern (weird one, but still, a pattern).

  • With hugo server -w
  • If I open up foo.md in TextMate2 (my preferred text editor)
  • Do first change = > Hugo rebuilds, browser reloads OK
  • Do second change => Nothing

I I instead make the changes by just appending to the file:

echo "foo" >> foo.md

I can make many changes and everything works as expected. So it must be something fishy with the events triggered by the repetitive saves in Textmate2.

@tcurdt what text editor do you use?

Member

bep commented Jun 28, 2015

The good thing is, I do not give up easily.

I have found a pattern (weird one, but still, a pattern).

  • With hugo server -w
  • If I open up foo.md in TextMate2 (my preferred text editor)
  • Do first change = > Hugo rebuilds, browser reloads OK
  • Do second change => Nothing

I I instead make the changes by just appending to the file:

echo "foo" >> foo.md

I can make many changes and everything works as expected. So it must be something fishy with the events triggered by the repetitive saves in Textmate2.

@tcurdt what text editor do you use?

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 28, 2015

Member

It's also working normally in TextEdit. So TextMate2 is the problem for me.

Member

bep commented Jun 28, 2015

It's also working normally in TextEdit. So TextMate2 is the problem for me.

@dunn

This comment has been minimized.

Show comment
Hide comment
@dunn

dunn Jun 28, 2015

Contributor

I can replicate this on TextMate also. It does not happen when I'm using Emacs.

Contributor

dunn commented Jun 28, 2015

I can replicate this on TextMate also. It does not happen when I'm using Emacs.

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt Jun 28, 2015

@bep Wow - that I didn't expect. Was also using Textmate2 at the time.

tcurdt commented Jun 28, 2015

@bep Wow - that I didn't expect. Was also using Textmate2 at the time.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 28, 2015

Member

Yea, looks like it's the Atomic Save feature that messes up live reload stuff (not only for Hugo, but also Grunt etc.) -- I can not find a way to turn it off (it was an option in TextMate 1).

Member

bep commented Jun 28, 2015

Yea, looks like it's the Atomic Save feature that messes up live reload stuff (not only for Hugo, but also Grunt etc.) -- I can not find a way to turn it off (it was an option in TextMate 1).

@bep bep changed the title from File change watcher is not working in Mac to File change watcher is not working in TextMate2 on Mac Jun 28, 2015

@PuffinBlue

This comment has been minimized.

Show comment
Hide comment
@PuffinBlue

PuffinBlue Jun 28, 2015

Contributor

I can replicate this with Textmate2. If you subsequently open a file, edit and save with another text editor post a Textmate 2 save, it still won't trigger the live reload, which is odd.

You seemingly must destroy the file and recreate it once Textmate 2 has been at it. This is beyond my knowledge level but does the live reload feature rely on the inode and then loses track if the file is overwritten and given a new inode in an 'atomic' save?

Atom and Sublime Text 3 both work normally with live reload.

I found this twitter thread with with macromates regarding the issue:

https://twitter.com/jacobgraf/status/285117156096606208

It's unresolved and OP claimed not to have heard back from them regarding the ability to turn it off.

Contributor

PuffinBlue commented Jun 28, 2015

I can replicate this with Textmate2. If you subsequently open a file, edit and save with another text editor post a Textmate 2 save, it still won't trigger the live reload, which is odd.

You seemingly must destroy the file and recreate it once Textmate 2 has been at it. This is beyond my knowledge level but does the live reload feature rely on the inode and then loses track if the file is overwritten and given a new inode in an 'atomic' save?

Atom and Sublime Text 3 both work normally with live reload.

I found this twitter thread with with macromates regarding the issue:

https://twitter.com/jacobgraf/status/285117156096606208

It's unresolved and OP claimed not to have heard back from them regarding the ability to turn it off.

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt Jun 28, 2015

Guess we should open an Textmate2 issue for this and reference it from here.

Wondering if this applies to all "atomic writes" though - not only with Textmate.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/#//apple_ref/occ/instm/NSData/writeToFile:atomically:

tcurdt commented Jun 28, 2015

Guess we should open an Textmate2 issue for this and reference it from here.

Wondering if this applies to all "atomic writes" though - not only with Textmate.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/#//apple_ref/occ/instm/NSData/writeToFile:atomically:

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 29, 2015

Member

Macromates answered me on Twitter:

https://twitter.com/macromates/status/615404461763248128

"@bepsays @joelkesler We use the exchangedata system call to perform the saves, should be possible for grunt-contrib-watch to recognize this."

Member

bep commented Jun 29, 2015

Macromates answered me on Twitter:

https://twitter.com/macromates/status/615404461763248128

"@bepsays @joelkesler We use the exchangedata system call to perform the saves, should be possible for grunt-contrib-watch to recognize this."

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt Jun 30, 2015

Maybe worth filing a bug on the watcher package then.

tcurdt commented Jun 30, 2015

Maybe worth filing a bug on the watcher package then.

@tcurdt

This comment has been minimized.

Show comment
Hide comment
@tcurdt

tcurdt Jul 13, 2015

I've now seen this in a js setup as well - which to me suggests a problem on an even lower level.

Super annoying.

tcurdt commented Jul 13, 2015

I've now seen this in a js setup as well - which to me suggests a problem on an even lower level.

Super annoying.

@renatovargas

This comment has been minimized.

Show comment
Hide comment
@renatovargas

renatovargas Aug 20, 2015

Contributor

Hello everyone. I installed Hugo with homebrew and I am also getting the problem where the server with the --watch option tracks only one save with Textmate 2.0-beta.7.4. I'm on a MacBook Air and OS X Yosemite 10.10.4. I could use another text editor, but for me Textmate is very comfortable. Has anyone figured out a straight forward workaround? Thanks to all of you. Wonderful work!

Contributor

renatovargas commented Aug 20, 2015

Hello everyone. I installed Hugo with homebrew and I am also getting the problem where the server with the --watch option tracks only one save with Textmate 2.0-beta.7.4. I'm on a MacBook Air and OS X Yosemite 10.10.4. I could use another text editor, but for me Textmate is very comfortable. Has anyone figured out a straight forward workaround? Thanks to all of you. Wonderful work!

@Kevin-Hamilton

This comment has been minimized.

Show comment
Hide comment
@Kevin-Hamilton

Kevin-Hamilton Aug 24, 2015

I just ran into this as well. Here's some issues from the fsnotify project that are probably related:
https://github.com/go-fsnotify/fsnotify/search?q=atomic&type=Issues

I'm not a Go developer, so I don't know that I can be much help, but here's some links I found in researching this that may be helpful to the Hugo developers:
golang/go#4068
howeyc/fsnotify#54
https://github.com/rjeczalik/notify

I just ran into this as well. Here's some issues from the fsnotify project that are probably related:
https://github.com/go-fsnotify/fsnotify/search?q=atomic&type=Issues

I'm not a Go developer, so I don't know that I can be much help, but here's some links I found in researching this that may be helpful to the Hugo developers:
golang/go#4068
howeyc/fsnotify#54
https://github.com/rjeczalik/notify

@Kevin-Hamilton

This comment has been minimized.

Show comment
Hide comment
@Kevin-Hamilton

Kevin-Hamilton Aug 24, 2015

Hm, I've done some testing with https://github.com/emcrisostomo/fswatch, with https://github.com/shama/gaze (the library behind gulp, grunt, etc), and with https://github.com/paulmillr/chokidar (the library behind browserify, webpack, etc) and all of them seem be succeeding at capturing multiple consecutive Textmate 2 saves. So I'm going to try and wire together a workaround to hugo server -w using one of these aforementioned projects until the underlying issue gets solved in hugo.

Maybe hugo could suggest a workaround like one of these in the docs, until a hugo fix surfaces...

Hm, I've done some testing with https://github.com/emcrisostomo/fswatch, with https://github.com/shama/gaze (the library behind gulp, grunt, etc), and with https://github.com/paulmillr/chokidar (the library behind browserify, webpack, etc) and all of them seem be succeeding at capturing multiple consecutive Textmate 2 saves. So I'm going to try and wire together a workaround to hugo server -w using one of these aforementioned projects until the underlying issue gets solved in hugo.

Maybe hugo could suggest a workaround like one of these in the docs, until a hugo fix surfaces...

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Aug 24, 2015

Member

We will when a workaround arrives.

Member

bep commented Aug 24, 2015

We will when a workaround arrives.

@renatovargas

This comment has been minimized.

Show comment
Hide comment
@renatovargas

renatovargas Aug 24, 2015

Contributor

Thanks Kevin.

Contributor

renatovargas commented Aug 24, 2015

Thanks Kevin.

@jbshirk

This comment has been minimized.

Show comment
Hide comment
@jbshirk

jbshirk Jan 10, 2016

I thought you'd like to know that this issue affects me when I use Brackets. It might detect the first change after a restart but doesn't after that. However, switching to TextSoap watch works fine.

HTH

jbshirk commented Jan 10, 2016

I thought you'd like to know that this issue affects me when I use Brackets. It might detect the first change after a restart but doesn't after that. However, switching to TextSoap watch works fine.

HTH

@mikekreuzer

This comment has been minimized.

Show comment
Hide comment
@mikekreuzer

mikekreuzer Jan 10, 2016

I get no updates at all with Atom 1.3.2/1.33. With TextEdit updates happen as I type, with Coda updates happen on file saves. Hugo v0.15 via brew.

I get no updates at all with Atom 1.3.2/1.33. With TextEdit updates happen as I type, with Coda updates happen on file saves. Hugo v0.15 via brew.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 10, 2016

Member

I have done some tests with TextMate andfsnotify`.

  • An edit triggers the events CHMOD + REMOVE
  • I guess the REMOVE triggers an un-watch in fsnotify

This hack-of-the-year works in my simple tests:

if event.Op&fsnotify.Remove == fsnotify.Remove {
    err = watcher.Add(event.Name)
    if err != nil {
        log.Fatal(err)
    }
}

@nathany - any input/advice on a temporary workaround for Hugo? This bug bugs me ...

/cc @spf13 @anthonyfok

Member

bep commented Jan 10, 2016

I have done some tests with TextMate andfsnotify`.

  • An edit triggers the events CHMOD + REMOVE
  • I guess the REMOVE triggers an un-watch in fsnotify

This hack-of-the-year works in my simple tests:

if event.Op&fsnotify.Remove == fsnotify.Remove {
    err = watcher.Add(event.Name)
    if err != nil {
        log.Fatal(err)
    }
}

@nathany - any input/advice on a temporary workaround for Hugo? This bug bugs me ...

/cc @spf13 @anthonyfok

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 10, 2016

Member

I have done some more testing and created a workaround-PR, see #1766

Member

bep commented Jan 10, 2016

I have done some more testing and created a workaround-PR, see #1766

bep added a commit to bep/hugo that referenced this issue Jan 10, 2016

Workaround for watching in TextMate etc.
An edit in `TextMate` on OS X triggers the events `CHMOD` and `REMOVE`.

This makes `fsnotify` stop watching that file.

This commit works around that problem by re-adding the file to the watcher on `REMOVE` if the file still exists.
See #1053
@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 10, 2016

Member

I thought you'd like to know that this issue affects me when I use Brackets.

@jbshirk just tested Brackets (nice editor) on OS X -- and it works fine for me re. watching (even without my patch).

Member

bep commented Jan 10, 2016

I thought you'd like to know that this issue affects me when I use Brackets.

@jbshirk just tested Brackets (nice editor) on OS X -- and it works fine for me re. watching (even without my patch).

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 10, 2016

Member

This patch in fsnotify fixes it for me in TextMate:

https://github.com/go-fsnotify/fsnotify/pull/111

Member

bep commented Jan 10, 2016

This patch in fsnotify fixes it for me in TextMate:

https://github.com/go-fsnotify/fsnotify/pull/111

@nathany

This comment has been minimized.

Show comment
Hide comment
@nathany

nathany Jan 14, 2016

Contributor

Thanks @bep. https://github.com/go-fsnotify/fsnotify/pull/111 is merged.

Those waiting for this fix can update fsnotify and rebuild Hugo.

go get -u gopkg.in/fsnotify.v1 
Contributor

nathany commented Jan 14, 2016

Thanks @bep. https://github.com/go-fsnotify/fsnotify/pull/111 is merged.

Those waiting for this fix can update fsnotify and rebuild Hugo.

go get -u gopkg.in/fsnotify.v1 

@bep bep closed this Jan 14, 2016

@jbshirk

This comment has been minimized.

Show comment
Hide comment
@jbshirk

jbshirk Jan 14, 2016

@bep Yes, it turned out to be a complex of issues, not the least was google drive interfering with normal finder functioning. Now brackets seems to be working the best of all the others I've tried.

jbshirk commented Jan 14, 2016

@bep Yes, it turned out to be a complex of issues, not the least was google drive interfering with normal finder functioning. Now brackets seems to be working the best of all the others I've tried.

@WallStProg

This comment has been minimized.

Show comment
Hide comment
@WallStProg

WallStProg May 3, 2018

It seems that this is still an issue w/version 2.0-rc.4.

It seems that this is still an issue w/version 2.0-rc.4.

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