fsmonitor: read entirety of watchman output
[gitweb.git] / templates / hooks--fsmonitor-watchman.sample
index c68038ef0045f55bb5675f899d59b94f335d1284..9eba8a740933dfa77d7155aca2ba1979e9d0fb68 100755 (executable)
@@ -49,9 +49,6 @@ launch_watchman();
 
 sub launch_watchman {
 
-       # Set input record separator
-       local $/ = 0666;
-
        my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j')
            or die "open2() failed: $!\n" .
            "Falling back to scanning...\n";
@@ -78,7 +75,8 @@ sub launch_watchman {
        END
 
        print CHLD_IN $query;
-       my $response = <CHLD_OUT>;
+       close CHLD_IN;
+       my $response = do {local $/; <CHLD_OUT>};
 
        die "Watchman: command returned no output.\n" .
            "Falling back to scanning...\n" if $response eq "";