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 23483f4a Allow for YAML not yet created
23483f4a is described below

commit 23483f4aa44f2b22e7f79015f32df49071a99715
Author: Sebb <s...@apache.org>
AuthorDate: Sun Mar 17 13:12:02 2024 +0000

    Allow for YAML not yet created
---
 tools/parsemail.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/parsemail.rb b/tools/parsemail.rb
index fa0adec6..116b3c2f 100755
--- a/tools/parsemail.rb
+++ b/tools/parsemail.rb
@@ -40,8 +40,12 @@ module ParseMail
   def self.parse_dir(maildir, yamlfile)
     # Has the directory changed since the last run?
     # If not, don't reprocess
-    ytime = File.mtime(yamlfile)
-    dtime = File.mtime(maildir)
+    begin
+      ytime = File.mtime(yamlfile)
+    rescue Errno::ENOENT # not yet created
+      ytime = Time.at(0)
+    end
+    dtime = File.mtime(maildir) # must exist
     if ytime > dtime + 60 # Allow for yaml update window
       log :INFO, "No change to #{maildir} (#{dtime}) since #{yamlfile} 
(#{ytime}), skipping"
       return

Reply via email to