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

Permission error is still thrown on exempted directory #517

Open
mattkelsey opened this issue Aug 2, 2016 · 0 comments
Open

Permission error is still thrown on exempted directory #517

mattkelsey opened this issue Aug 2, 2016 · 0 comments

Comments

@mattkelsey
Copy link

Context: here is a problem I had a little while back.
I had a grunt watch task like so:

watch: {
  express: {
    files: [
      'server/**/*.{js,json}',
      '!server/influx/**' //this should leave out the protected subdirs of influx (read below)
      //'!server/influx' -- this also didn't work
    ],
    tasks: ['express:dev', 'wait'],
    options: {
      livereload: true,
      nospawn: true
    }
  }
},

The directory server/influx was mounted as a volume in a docker container. This was important because it meant that its subdirectories were protected, grunt didn't have access. server/influx was not protected only the subdirectories (and all of their subdirs recursively).

When the watch task was run I received the following warning:
Warning: EACCES: permission denied, scandir 'server/influx/data/_internal/monitor'

While this was just a warning it seemed to be halting grunt, none of my other tasks were being executed. With the --force option grunt seemed to skip the watch task, thus not running the express task and so nothing was getting served.

I had explicitly told my watch task to ignore all subdirectories in server/influx so it would seem that grunt should not have been trying to scan those directories.

Also neither express:dev or wait contained any wildcards or direct references to any of the subdirectories in server/influx and the error still occurred when those tasks were removed.

The (not optimal) solution to this was as follows:

watch: {
  express: {
    files: [
      'server/{api,components,config}/**/*.{js,json}' //note that this does not include server/influx only the other subdirs
    ],
    tasks: ['express:dev', 'wait'],
    options: {
      livereload: true,
      nospawn: true
    }
  }
},

It seems that if I explicitly state the subdirectories to look in rather than using a wildcard and exempting server/influx/** it works as expected with no permission warning thrown.

So I believe the issue is that when a wildcard is used to include all subdirectories and one is excluded, grunt will still throw permission errors on the excluded directory if it doesn't have access which can in some cases halt tasks.

I would like to be able to include all sub directories except for one that grunt will not have permissions to in order to suppress permission errors. This way if I add new directories I want grunt to watch in the future to server/ I won't have update my Gruntfile.

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

1 participant