Module: tools Branch: master Commit: be1fa7e49ec5c2a8c8599752a0b216062fdbf79e URL: http://source.winehq.org/git/tools.git/?a=commit;h=be1fa7e49ec5c2a8c8599752a...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Oct 15 15:32:39 2012 +0200
testbot/lib: If we cannot open the log file, then log to stderr.
---
testbot/lib/WineTestBot/Log.pm | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/testbot/lib/WineTestBot/Log.pm b/testbot/lib/WineTestBot/Log.pm index 6883968..7de6dcb 100644 --- a/testbot/lib/WineTestBot/Log.pm +++ b/testbot/lib/WineTestBot/Log.pm @@ -38,20 +38,18 @@ sub LogMsg(@) if (!defined $logfile) { my $oldumask = umask(002); - if (open($logfile, ">>", "$LogDir/log")) - { - # Flush after each print - my $tmp=select($logfile); - $| = 1; - select($tmp); - } - else + if (!open($logfile, ">>", "$LogDir/log")) { require File::Basename; print STDERR File::Basename::basename($0), ":warning: could not open '$LogDir/log' for writing: $!\n"; - $logfile = undef; + open($logfile, ">>&=", 2); } umask($oldumask); + + # Flush after each print + my $tmp=select($logfile); + $| = 1; + select($tmp); } print $logfile scalar localtime, " ", @_ if ($logfile); }