This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 873f9851 only show $stderr for embedded usage
873f9851 is described below
commit 873f9851b175776ba9ad78e940b42bf8cef53055
Author: Sebb <[email protected]>
AuthorDate: Fri Feb 10 17:02:04 2023 +0000
only show $stderr for embedded usage
$stdout can cause issues for HTML and JSON output
---
tools/parsemail.rb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/parsemail.rb b/tools/parsemail.rb
index 927243c2..18b3dfc5 100755
--- a/tools/parsemail.rb
+++ b/tools/parsemail.rb
@@ -29,9 +29,10 @@ module ParseMail
MAIL_ROOT = '/srv/mail'
def self.log(level, text)
- out = $stdout
+ out = nil
+ out = $stdout if __FILE__ == $0 # only write to stdout from this script
out = $stderr if level == :WARN
- out.puts "#{Time.now} #{level}: #{text}"
+ out.puts "#{Time.now} #{level}: #{text}" unless out.nil?
end
def self.parse_dir(maildir, yamlfile)