Grunt/Gulp watch from Windows guest to mounted Mac drive

Discussion in 'Windows Virtual Machine' started by PeteD2, Jul 7, 2015.

  1. PeteD2

    PeteD2 Bit poster

    Messages:
    8
    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?
     
  2. PaulChristopher@Parallels

    PaulChristopher@Parallels Product Expert Staff Member

    Messages:
    3,158
    Hi PeteD2,
    Please submit a Problem Report ID http://kb.parallels.com/9058 and provide us the ID number here, to investigate further on this issue.
     
  3. PeteD2

    PeteD2 Bit poster

    Messages:
    8
    I submitted Problem Report #69734350 as requested.
     
  4. PeteD2

    PeteD2 Bit poster

    Messages:
    8
  5. marat_t

    marat_t Pro

    Messages:
    288
    Hi,
    I've created a request to Development. Will share updates here, if any
     
  6. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    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?
     
  7. PeteD2

    PeteD2 Bit poster

    Messages:
    8
    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.

     
  8. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    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.
     
  9. RuneB1

    RuneB1 Bit poster

    Messages:
    3
    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?
     
  10. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    It's to be fixed at our side. Sorry for the inconvenience.
     
  11. RuneB1

    RuneB1 Bit poster

    Messages:
    3
    Do you have any ETA on this?
     
  12. vasilyz

    vasilyz Parallels Developers

    Messages:
    84
    We have already fixed this in PD11.1
     
  13. RuneB1

    RuneB1 Bit poster

    Messages:
    3
    OK, will try with gulp-watch plugin instead of gulp.watch, as it seems to work better with network shares.
     
  14. JohnnyO

    JohnnyO Bit poster

    Messages:
    1
    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: Jun 27, 2017

Share This Page