summaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index dcd107b81..2ad80ced3 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -195,10 +195,25 @@ sub render ($) { #{{{
$oldpagemtime{$page}=time;
}
else {
- my $content=readfile($srcfile, 1);
+ my $srcfd=readfile($srcfile, 1, 1);
delete $depends{$file};
will_render($file, $file, 1);
- writefile($file, $config{destdir}, $content, 1);
+ my $destfd=writefile($file, $config{destdir}, undef, 1, 1);
+ my $blksize = 16384;
+ my ($len, $buf, $written);
+ while ($len = sysread $srcfd, $buf, $blksize) {
+ if (! defined $len) {
+ next if $! =~ /^Interrupted/;
+ error("failed to read $srcfile: $!");
+ }
+ my $offset = 0;
+ while ($len) {
+ defined($written = syswrite OUT, $buf, $len, $offset)
+ or error("failed to write $file: $!");
+ $len -= $written;
+ $offset += $written;
+ }
+ }
$oldpagemtime{$file}=time;
}
} #}}}