l10n: sv.po: Update Swedish translation (3288t0f0u)
[gitweb.git] / t / t7519 / fsmonitor-watchman
index 7ceb32dc181b644d705c59f23c8708d51bc965f4..5514edcf68be8020ca94e8c51b9c9f2b3102bd09 100755 (executable)
@@ -29,19 +29,13 @@ if ($version == 1) {
            "Falling back to scanning...\n";
 }
 
-# Convert unix style paths to escaped Windows style paths when running
-# in Windows command prompt
-
-my $system = `uname -s`;
-$system =~ s/[\r\n]+//g;
 my $git_work_tree;
-
-if ($system =~ m/^MSYS_NT/) {
-       $git_work_tree = `cygpath -aw "\$PWD"`;
-       $git_work_tree =~ s/[\r\n]+//g;
-       $git_work_tree =~ s,\\,/,g;
+if ($^O =~ 'msys' || $^O =~ 'cygwin') {
+       $git_work_tree = Win32::GetCwd();
+       $git_work_tree =~ tr/\\/\//;
 } else {
-       $git_work_tree = $ENV{'PWD'};
+       require Cwd;
+       $git_work_tree = Cwd::cwd();
 }
 
 my $retry = 1;
@@ -50,9 +44,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";
@@ -83,7 +74,8 @@ sub launch_watchman {
        close $fh;
 
        print CHLD_IN $query;
-       my $response = <CHLD_OUT>;
+       close CHLD_IN;
+       my $response = do {local $/; <CHLD_OUT>};
 
        open ($fh, ">", ".git/watchman-response.json");
        print $fh $response;
@@ -131,6 +123,7 @@ sub launch_watchman {
            "Falling back to scanning...\n" if $o->{error};
 
        open ($fh, ">", ".git/watchman-output.out");
+       binmode $fh, ":utf8";
        print $fh @{$o->{files}};
        close $fh;