-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toaster -w conflict with the default saving file behavior in vim #47
Comments
The same happens when will run Toaster alone, without the Livereload / Guard? Seeing the stack trace you pasted I suspect it's the same of a previous issue (theoretically fixed #37). If it happens even when you run Toaster without the others players, tell me how to reproduce it and which platform it's happening so I can take a closer look. Thanks p.s.: I answered your email at the group in case you didn't see it yet: |
without Guard / Livereload here is my toaster.coffee: # => SRC FOLDER
toast 'assets/coffeescripts'
# EXCLUDED FOLDERS (optional)
exclude: ['.swp', '.tmp' ]
# => VENDORS (optional)
# vendors: ['vendors/x.js', 'vendors/y.js', ... ]
# => OPTIONS (optional, default values listed)
# bare: false
# packaging: true
# expose: ''
minify: false
# => HTTPFOLDER (optional), RELEASE / DEBUG (required)
httpfolder: ''
release: 'assets/javascripts/main.js'
debug: 'assets/javascripts/main-debug.js' toaster output: [14:25:15] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
[14:25:31] File deleted, stop watching /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee
[14:25:31] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
[14:25:31] New file created /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee
[14:25:31] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
[14:25:48] File deleted, stop watching /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/get_elapsed_time.coffee
[14:25:48] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:1200
file.item.getinfo();
^
TypeError: Cannot read property 'item' of null
at __t.Builder.Builder.watch (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:1200:19)
at __t.FnUtil.FnUtil.proxy (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:348:19)
at StatWatcher.__t.FsUtil.FsUtil.watch_file (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:530:51)
at StatWatcher.EventEmitter.emit (events.js:99:17)
at StatWatcher._handle.onchange (fs.js:889:10) what I did was:
oh! big point! |
Hi, is this happening frequently? To reproduce this I had to keep typing "ESC + : + w + ENTER" with the file opened in VIM in an INSANELY fast way I didn't know I was capable of. The error rises both inside and outside the Dropbox folder. Basically, at some point the file stats gets 'nlink=0' which means the file was deleted. To go further, I also put another check of 'fs.existsSync' and it incredibly also returned 'false'. This is beyond Toaster. In other hand the stack trace you pasted suggets it's happening EVERYTIME you save a file (:x and :w). Is that correct? You're running linux right? Which distro? |
Hi, I've made an attempt to reduce this problems with "deleted files" that was not actually deleted. Please update to the latest version 0.6.5 and tell me if something changes. |
that was exactly what I did! I am running Ubuntu 12.04 i386 with nodejs v0.8.14:
and you were right again: I used and I test in Ubuntu 10.04 i386 with nodejs v0.8.15:
the same result, when I vim test.coffee and console.log 'hi' toaster crash :-(
my toaster.coffee: # => SRC FOLDER
toast 'assets/coffeescripts'
# EXCLUDED FOLDERS (optional)
exclude: ['.swp', '.tmp' ]
# => VENDORS (optional)
# vendors: ['vendors/x.js', 'vendors/y.js', ... ]
# => OPTIONS (optional, default values listed)
# bare: false
# packaging: true
# expose: ''
minify: false
# => HTTPFOLDER (optional), RELEASE / DEBUG (required)
httpfolder: ''
release: 'assets/javascripts/main.js'
debug: 'assets/javascripts/main-debug.js' it got worse at toaster v0.6.5, so I got back to v0.6.4 now ... |
Ok, I'm in the middle of a big refactor from the ground up aiming to solve all this problems concerning filesystem in Windows. I'll take advantage of the moment and build up an Ubuntu vm as well so I can hopefully fix it for everyone across all platforms (osx, windows and linux). |
if you need to do any test in Ubuntu, I could do it for you. I tried to use |
@zx1986 Hi, I've detached the Can you pls check it out and tells me if it (finally) worked? npm install -g git://github.com/serpentem/coffee-toster#cross-platform-refactor |
Ops there was a typo, again: npm install -g git://github.com/serpentem/coffee-toaster#cross-platform-refactor |
sorry for so late to reply! YOU are such a sweet DEVELOPER! 💯 but when I testing Ubuntu 12.10 i386, I got something wrong .... I got a firewall out of my control, it doesn't allow me to use git protocol (TCP 22 port), git clone http://github.com/serpentem/coffee-toaster.git
cd coffee-toaster
git checkout -b cross remotes/origin/cross-platform-refactor
cd ..
tar zcvf coffee-toaster.tar.gz coffee-toaster/
npm install -g coffee-toaster.tar.gz then I got: $ npm list -g
/home/zx1986/nvm/v0.8.14/lib
├── coffee-script@1.4.0
├─┬ coffee-toaster@0.6.6
│ ├── coffee-script@1.3.3
│ ├── colors@0.5.1
│ ├── fs-util@0.3.2
│ ├── growl@1.2.1
│ ├─┬ optimist@0.2.8
│ │ └── wordwrap@0.0.2
│ ├── uglify-js@1.1.1
│ └─┬ vows@0.6.4
│ ├── diff@1.0.4
│ └── eyes@0.1.8 toaster-coffee commit commit 9291fb40149cae13b350c93238961a6e73a6d7a3
Author: arboleya <anderson@arboleya.me>
Date: Sun Dec 9 23:06:33 2012 -0200
Updating `fs-util` version in `package.json`. when I open a coffee file, then
when I open a coffee file, do nothing, then may I know what is your ubuntu version ? I will test again when I get home, my PC at home is Ubuntu 12.10 i386, |
Hell, all my attempts to fix all the shits around the Ok, lets do it one more time, I noticed this weird line in the stack you pasted: [09:39:06] New file created /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee~ It's so weird, because a file ending with It's a kind of temporary file in Linux? Vim saves the Well, in this meanwhile can you pls run the tests suite for me and paste the results here? git clone git://github.com/serpentem/fs-util
cd fs-util && npm install && make test Btw, my ubuntu is 12.04.1 i386. I couldn't install the 12.10 in Virtual Box because of a real painful slowness, the system seems to have driver issues in Virtual Box, so I switched to 12.04 thinking that would be enough. |
Ops, I think I got it here, here and here. Dumb mistake, a simple Please update Toaster again and see if it (god have mercy) works now: npm install -g git://github.com/serpentem/coffee-toaster#cross-platform-refactor If you're behind firewall, use this (simpler) snippet, will save you some lines and seconds. 👌 git clone --branch=cross-platform-refactor http://github.com/serpentem/coffee-toaster
cd coffee-toaster && npm install && npm link |
Reinstallcd /tmp
git clone --branch=cross-platform-refactor http://github.com/serpentem/coffee-toaster
cd coffee-toaster
npm install -g npm list -g
/home/zx1986/nvm/v0.8.14/lib
├── coffee-script@1.4.0
├─┬ coffee-toaster@0.6.6
│ ├── coffee-script@1.3.3
│ ├── colors@0.5.1
│ ├── fs-util@0.3.3
│ ├── growl@1.2.1
│ ├─┬ optimist@0.2.8
│ │ └── wordwrap@0.0.2
│ ├── uglify-js@1.1.1
│ └─┬ vows@0.6.4
│ ├── diff@1.0.4
│ └── eyes@0.1.8 Testing
[14:32:52] File deleted, stop watching /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee
[14:32:52] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
[14:32:52] New file created /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee
[14:32:52] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
fs.js:524
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT, no such file or directory '/home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/alert.coffee~'
at Object.fs.statSync (fs.js:524:18)
at DirWatcher.onchange (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:295:16)
at FSWatcher.__bind (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:4:61)
at FSWatcher.EventEmitter.emit (events.js:99:17)
at FSEvent._handle.onchange (fs.js:826:12) The vim swap file (filename~)I thought this is the main problem of mine:
Reference: Modified .vimrc and testing again ( it works! )" for coffee-toaster
set nobackup " no backup files
set nowritebackup " only in case you don't want a backup file while editing
set noswapfile " no swap files seem these beautiful output:
oh ~ my dear toaster machine! 🉑 |
Hi, it's great news. :) But anyway, the weird thing is that fixed this! I mean, files ending with That's the current regex filter, there's no space for the # ...
@watchers.push (watcher = fsu.watch src.path, /.coffee$/m)
# ... |
Just to let you know, I reproduced the (motherfucker) error. Looking into it to fix without any changes to your vim configs. The ideal fix is the only viable fix. 😸 |
Indeed!
haha! I think there is a bug in fsu.watch ? but I test fs-util with vim, it was just fine, weird .... |
Well, after some research I came to the conclusion that the only way to work reliably with VIM and Toaster is this way you've mentioned. When you save the file It's like VIM deletes it and so creates a new one with the contents coming from the swap, I dont know exactly what happens, but in other words, VIM uses this specific saving-cycle between all these backups, swaps and original files that turns it impossible to have the expected results. There are so much variations and weirdness around this matter that the best option now is makes VIM work as expected -- the way you did -- than trying to understanding it's deepest emotions and childhood behaviors. :) |
Here we go, I just release the 0.6.6, please update and let me know if something weird happens. Btw, thanks to you I put a note for vim users on the REAME. ;) |
that's ok! arboleya! |
@arboleya could you explain why this issue is closed? Forcing users to change their setup doesn't look like a good solution. |
@mlen Hi Mateusz, I understand your frustration because I agree a hundred percent wit you. But instead of forcing users to do something, I'm just trying to help them do something if they use VIM and are willing to benefit from Toaster. As you can see in this thread I digged very deep into this subject with @zx1986 but I ended up with no solution for this. So instead of no solution at all, there's a workaround to make things work as expected. The FS API of node itself is pretty unstable across different platforms, this made me build a new tool just to have a closer control over fs operations in different platforms (win,mac,linux). Furthermore, the VIM behaviors is pretty unlikely any other editor. When you hit You'll face the very same problem with all the libraries that do this watch'n'compile thing. VIM, specifically over all other editors I tested, behaviors in a completely different way when it concerns to FS manipulation. But as I said, I agree with you. So if anything can be done to make this work as expected I'd be happy to do it. Do you have any suggestion? Did you have a closer contact with filesystem watching? Do you know deeply how VIM works on this matter? |
hello there! I am using a vim plugin called vim-coffee-script , but I thought this plugin just do things in the vim way: check the bottom line in this image: "--No lines in buffer--" |
That looks awesome! As it seems it's realtime, isn't it? As you type coffee in one side, it automatically compiles it to js on the other. Fabulous. But I'm afraid it's only possible because it's a VIM plugin, and because of that it runs under the VIM architecture (unlike Toaster). As Toaster isn't a plugin for anything, this can't be that specific. |
@arboleya thanks for the effort :) Fortunately I found a better solution than disabling vim functionality (disabling swap files is discouraged by the manual). There are two strategies for writing files and by default vim decides which one to use (read The line below changes vim behavior to create the backup file by copying the original instead of doing a rename. set backupcopy=yes Or even better when combined with autocmd BufRead,BufNewFile *.coffee setlocal backupcopy=yes This still is only a workaround and I think |
I got something pretty weird ........ I comment all the setting for Toaster in .vimrc: " for coffee-toaster
"autocmd BufRead,BufNewFile *.coffee setlocal backupcopy=yes
"set nobackup
"set nowritebackup
"set noswapfile then, with Toaster, everything goes fine! here is my env:
|
@zx1986 unfortunately it still doesn't work on OS X. @arboleya I think there is another bug only occurring when I edit
I'm using OS X 10.7.5 and vim 7.3.762
|
@zx1986 You're kidding. Now I don't know what to say. Maybe VIM was operating with the vars still on? @mlen I see, well I need to take a closer look to see what happening. But just te be clear, what is all the differences between the With it set all goes well, except the `ENOENT``? Without the |
To make it simple, I created an virtual machine with Ubuntu 12.10 i386. Then, I got the error again: [21:42:33] File deleted, stop watching /home/zx1986/www/coffee/a.coffee
[21:42:33] Compiled /home/zx1986/www/javascripts/main.js
[21:42:33] New file created /home/zx1986/www/coffee/a.coffee
fs.js:524
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT, no such file or directory '/home/zx1986/www/coffee/a.coffee~'
at Object.fs.statSync (fs.js:524:18)
at Object.exports.ls.ls (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:123:15)
at Builder.__t.Builder.Builder.build_ns_tree (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:847:21)
at Builder.__t.Builder.Builder.build_namespaces (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:830:14)
at Builder.__t.Builder.Builder.build (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:743:25)
at Builder.__bind [as build] (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:27:61)
at Builder.__t.Builder.Builder.on_fs_change (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:942:21)
at __bind (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:27:61)
at Watcher.__t.FnUtil.FnUtil.proxy (/home/zx1986/.nvm/v0.8.16/lib/node_modules/coffee-toaster/lib/toaster.js:367:19)
at Watcher.EventEmitter.emit (events.js:96:17) Even after I put [21:42:33] Compiled /home/zx1986/www/javascripts/main.js
[21:42:33] New file created /home/zx1986/www/coffee/a.coffee
fs.js:524
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT, no such file or directory '/home/zx1986/www/coffee/a.coffee~'
...... Things went fine until I put these 3 line back into .vimrc:
I googled something about
Reference: I thought the regular file watching way (like FS) has no fitted event for save operating in vim .... |
2012-12-11
I thought there was vim environment problem, NOT a coffee-toaster bug. so, I rename the title.
here is the error output:
here is the offee file, timer.coffee:
In
file.item.getinfo()
, the file means that file which has been watched ?I ran guard + livereload + toaster at same time, will that cause this problem ?
The text was updated successfully, but these errors were encountered: