Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mod config script to tee output to config.log

  • Loading branch information...
commit 984cb27a7d25d1e6200658e868bc612a5bfd92da 1 parent 07c6d61
@nol888 nol888 authored
Showing with 40 additions and 0 deletions.
  1. +38 −0 Configure.pl
  2. +2 −0  lib/Parrot/Configure/Utils.pm
View
38 Configure.pl
@@ -23,6 +23,44 @@
$| = 1; # $OUTPUT_AUTOFLUSH = 1;
+sub tee {
+ # Try forking.
+ my $pid = open(STDOUT, "|-");
+ die "cannot fork: $!" unless defined $pid;
+
+ if ($pid) {
+ # Parent redirects stderr to stdout and returns.
+ open(STDERR, ">&STDOUT");
+ }
+ else {
+ # Child opens the log file and then exits when the parent does.
+ die "cannot open config.log for writing: $!" unless open(my $handle, ">", "config.log");
+
+ select($handle);
+ $| = 1;
+
+ while(sysread(*STDIN, $_, 2048) > 0) {
+ # Log prompt responses to file as well.
+ if(/^<promptanswer (.*)>\n(.*)$/) {
+ print "$1\n";
+
+ # If we slurped some extra data, print that normally.
+ if($2) {
+ print $2;
+ print STDOUT $2;
+ }
+
+ next;
+ }
+
+ print $_;
+ print STDOUT $_;
+ }
+ exit;
+ }
+}
+tee();
+
# Install Option text was taken from:
#
# autoconf (GNU Autoconf) 2.59
View
2  lib/Parrot/Configure/Utils.pm
@@ -161,6 +161,8 @@ sub prompt {
$value = $input;
}
+ print("<promptanswer $input>\n");
+
return integrate( $value, $input );
}
Please sign in to comment.
Something went wrong with that request. Please try again.