grunt-newer
grunt-newer copied to clipboard
Fixed grunt newer failing to restore configuration
When grunt newer runs a task that fails, it will not restore the configuration leading to numerous silent bugs, especially when running newer on things like watch. Using override will solve this problem as we have no clean way to run post tasks once the main task has failed. This is basically re-creating try finally using force.
If you like this approach to solving the problem, I can create tests so we can get this merged in.
I got the idea for a force task from the comment here, https://github.com/gruntjs/grunt/issues/810#issuecomment-27363230
I've been diving into the grunt source code, and i think there may be a way to run a task and know when it finishes by using grunt.task directly. I would like to look into it then open this PR again once I know if there is a better way or not.
the force
option is to enable the --force behavior built into grunt
from the grunt command line help
--force, -f A way to force your way past warnings. Want a suggestion?
Don't use this option, fix your code.
pull request cleaned up @tschaub wanna review this?
Can you provide an example that demonstrates the problem (and show how this change addresses it)? It's not clear looking at the code alone. An example repo or a gist with enough code to reproduce the issue would be great.
It looks like @guncha uploaded repro steps - https://github.com/guncha/grunt-newer-conf-corruption/commit/1deb15b7bf64269639226f5ecf60d95a66f2bb22
@tschaub , are you able to reproduce using that test case?
Our team had to fork grunt-newer
a while ago to fix this issue. We'd really like to delete our fork, but this is a blocking issue for us.