Grunt/Gulp watch from Windows guest to mounted Mac drive

PeteD2

Bit poster
I'm using a Windows 8.1 guest as a .Net development machine on my Yosemite host with Parallels 10.

I've set up the tool "gulp" which is a JavaScript task runner typically used for building web assets such as CSS and JavaScript. There is a "watch" command that fires tasks when target files are changed. My problem is that when "watching" files on the mounted Mac share (Y: drive) changes are CONSTANTLY being detected even when nothing has been changed. I suspect there is something wrong with the file change event publishing between Parallels and Windows.

Is anyone aware of a solution that doesn't just involve moving the files to the Windows drive (C). I like to keep all my projects on the Mac side. Is this a bug in Parallels that can be fixed?
 
Most probably this is a limitation in Parallels Shared Folders. We have some due to a totally different APIs for directory change notifications in OSX and Windows.
PeteD2, I am not familiar with gulp, so could you please provide simple steps to reproduce the issue?
 
Most probably this is a limitation in Parallels Shared Folders. We have some due to a totally different APIs for directory change notifications in OSX and Windows.
PeteD2, I am not familiar with gulp, so could you please provide simple steps to reproduce the issue?

Sure, here's how to reproduce the problem.
  1. Download and install Node.js from https://nodejs.org/
  2. Open a Windows command prompt or Powershell
  3. Navigate to one of your Mac shared folders (Y: in my case)
  4. Create a folder "gulptest" and navigate inside of it
  5. Install Gulp globally with "npm install -g gulp"
  6. Install Gulp in your folder with "npm install --save-dev gulp"
  7. Create a text file "test.txt" in the folder. The content doesn't matter.
  8. Create a file "gulpfile.js" in the folder with the following content:
    Code:
    var gulp = require('gulp');
    
    var paths = [
        '*.txt'
    ];
    
    gulp.task('watch', function () {
        gulp.watch(paths, function(event) {
            console.log('File ' + event.path + ' was ' + event.type);
        });
    });

  9. From the Windows command prompt, run "gulp watch". You should get something like this:

    Code:
    [15:17:25] Using gulpfile Y:\Projects\gulptest\gulpfile.js
    [15:17:25] Starting 'watch'...
    [15:17:25] Finished 'watch' after 11 ms
    File Y:\Projects\gulptest\test.txt was changed
    File Y:\Projects\gulptest\test.txt was changed
    File Y:\Projects\gulptest\test.txt was changed
    File Y:\Projects\gulptest\test.txt was changed
  10. The expected behavior is that no "was changed" notification happen unless the .txt file was modified and saved, but the notifications continue repeatedly for a while. You can also try creating and deleting other .txt files in the folder. I only see a single notification for those actions.
 
Sure, here's how to reproduce the problem.
Thank you for the instruction. I've reproduced the issue. It looks like the directory change notifications API is not in use at all. There are frequent requests for low-level file information from node.exe process (several times per second). I've concluded it compares the info between requests and sees whether it has changed. The problem is the Parallels Shared Folders driver (prl_fs.sys) reports non-persistent 'IndexNumber's (https://msdn.microsoft.com/en-us/library/windows/hardware/ff540318(v=vs.85).aspx) and the program thinks the file has changed. I've verified this by temporarily setting the IndexNumber field to zero (and making it persistent this way) in the driver. So, the best way to solve the problem with gulp is to implement more persistent IndexNumbers in prl_fs.sys.
 
I am also having this issue after updating node.js to version 4, wasn't a problem before. Setup: windows 10 as guest server, running gulp watch in OS X host. What can I do?
 
I am also having this issue after updating node.js to version 4, wasn't a problem before. Setup: windows 10 as guest server, running gulp watch in OS X host. What can I do?
It's to be fixed at our side. Sorry for the inconvenience.
 
Hmmm, I'm running Parallels Desktop 12 on macOS Sierra (with guest OS Windows 10) and this still seems to be an issue. File change events are being detected constantly when nothing changes. Anything I can do to fix this? I'm having trouble with both gulp.watch and the gulp-watch plugin. I'm even running the gulp task inside of the guest OS (Windows 10) and the same problem occurs, so it doesn't look like it's even a problem with the networking between host and guest OS.
 
Last edited:
Back
Top