Skip to content
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

Watch doesn't detect cascading changes when nospawn is true #510

Open
bchabrier opened this issue May 30, 2016 · 1 comment
Open

Watch doesn't detect cascading changes when nospawn is true #510

bchabrier opened this issue May 30, 2016 · 1 comment

Comments

@bchabrier
Copy link

I have noticed a wrong behaviour of watch when nospawn is true. At least, watch doesn't behave the same as when nospawn is false.

The use case I am considering is a frequent use case where a change to a source file triggers a change to a destination file. This is typically the case when files are compiled (e.g. .sass files into .css), or copied to a production folder.

For the sake of simplification, I have built the following example:

copy: {
  cascade: {
    src: 'lib/source.js',
    dest: 'lib/destination.js',
  },
},

watch is configured to trigger the copy when the source file is modified. It also watches the destination file. Note the nospawn: true option:

watch: {
    cascading: {
      files: ['lib/source.js'],
      tasks: ['copy:cascade'],
      options: {
        nospawn: true,
      },
    },
    cascaded: {
      files: ['lib/destination.js'],
    },
},

With this configuration, a change of the source file should trigger the copy task, which modifies the destination file. This change is unfortunately not detected by watch, as shown by the traces:

$ grunt watch
Running "watch" task
Waiting...
>> File "lib/source.js" changed.
Running "copy:cascade" (copy) task
Copied 1 file

Running "watch" task
Completed in 0.098s at Mon May 30 2016 20:19:16 GMT+0200 (CEST) - Waiting...

On the other hand, when specifying nospawn: false, the modification of the destination file is correctly detected:

$ grunt watch
Running "watch" task
Waiting...
>> File "lib/source.js" changed.
Running "copy:cascade" (copy) task
Copied 1 file

Done, without errors.
Completed in 5.142s at Mon May 30 2016 20:22:15 GMT+0200 (CEST) - Waiting...
>> File "lib/destination.js" changed.
Completed in 0.001s at Mon May 30 2016 20:22:15 GMT+0200 (CEST) - Waiting...

Although using nospawn: false is a good workaround, it has much lower performances, hence it would be great if the issue could be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants