linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Delete js source files before your coffeefy to prevent errors fixes #302 #381

Closed mbutsko closed 8 years ago

mbutsko commented 8 years ago

Rather than try to delete them after they were possibly converted, just remove them earlier.

searls commented 8 years ago

Thanks for digging this up!

searls commented 8 years ago

fixes #302

searls commented 8 years ago

Hey @mbutsko were you able to replicate #302 before you sent this patch? I just tried lineman new test1234 --skip-examples --coffee with and without the patch and both exited cleanly.

mbutsko commented 8 years ago

So yesterday, I encountered it without the coffee flag:

~ % lineman new bob --skip-examples
...

fs.js:77
      throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
            ^
Error: ENOENT, unlink '/Users/butsko/bob/app/js/hello.coffee'
    at Error (native)

Without the flag it shouldn't work without the patch, since it won't turn the .js into .coffee before trying to remove the .coffee.

Also, I think because it's asynchronously renaming files while at the same time trying to remove them, I can imagine it being intermittent with the flag (it managed to rename both files before attempting to remove them, which would result it no error...?)

searls commented 8 years ago

Ah, and perhaps there's something here we can make synchronous.

searls commented 8 years ago

Thanks for the explanation