grunt-newer icon indicating copy to clipboard operation
grunt-newer copied to clipboard

Fixed grunt newer failing to restore configuration

Open NullSoldier opened this issue 9 years ago • 5 comments

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

NullSoldier avatar May 20 '15 07:05 NullSoldier

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.

NullSoldier avatar May 20 '15 08:05 NullSoldier

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.

diwu1989 avatar May 20 '15 21:05 diwu1989

pull request cleaned up @tschaub wanna review this?

diwu1989 avatar Jun 15 '15 06:06 diwu1989

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.

tschaub avatar Jun 15 '15 06:06 tschaub

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.

terite avatar May 05 '16 06:05 terite