@@ -43,6 +43,33 @@ my $benchmark = eval "use Benchmark; 1";
43
43
# declare package variables
44
44
my ($parent_pid , $child_pid ) = ($$ , 0);
45
45
46
+ # ###################################################################################################
47
+ # reset/reinit is needed to avoid a bug on windows
48
+ # version strawberry-perl-5.22.2.1-32bit-portable
49
+ # https://github.com/sass/perl-libsass/issues/33
50
+ # ###################################################################################################
51
+
52
+ sub reset_encoding ()
53
+ {
54
+ binmode (STDIN , " :raw" );
55
+ binmode (STDOUT , " :raw" );
56
+ binmode (STDERR , " :raw" );
57
+ }
58
+
59
+ sub reinit_encoding ()
60
+ {
61
+ binmode (STDIN , " :encoding(console_in)" );
62
+ binmode (STDOUT , " :encoding(console_out)" );
63
+ binmode (STDERR , " :encoding(console_out)" );
64
+ }
65
+
66
+ sub forks {
67
+ reset_encoding();
68
+ my $pid = fork ();
69
+ reinit_encoding();
70
+ return $pid ;
71
+ }
72
+
46
73
# ###################################################################################################
47
74
# the watchdog process (maybe put in own module)
48
75
# ###################################################################################################
@@ -128,7 +155,7 @@ sub watchdog_parent ($$$)
128
155
# new watch file list
129
156
$files = \@includes ;
130
157
# start new child process
131
- unless ($child_pid = fork ())
158
+ unless ($child_pid = forks ())
132
159
{ watchdog_child($changes , $files ); }
133
160
}
134
161
@@ -240,7 +267,7 @@ sub start_watchdog ($$)
240
267
my @files = @{$stats -> {' included_files' } || []};
241
268
242
269
# start child process
243
- if ($child_pid = fork ())
270
+ if ($child_pid = forks ())
244
271
{ watchdog_parent($changes , \@files , $compile ); }
245
272
else { watchdog_child($changes , \@files ); }
246
273
0 commit comments