chiark / gitweb /
buffering_output feature (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 13:47:16 +0000 (13:47 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 13:47:16 +0000 (13:47 +0000)
subdirmk/generate

index 110f8f1..f353702 100755 (executable)
@@ -52,6 +52,7 @@ sub target_varname ($$) {
 }
 
 our $writing_output;
+our $buffering_output;
 our %output_files;
 
 sub close_any_output_file() {
@@ -62,6 +63,10 @@ sub close_any_output_file() {
 }
 
 sub o {
+    if (defined $buffering_output) {
+       $buffering_output .= $_ foreach @_;
+       return;
+    }
     die unless defined $writing_output;
     print O @_ or die "error writing $writing_output.tmp: $!\n";
 }