summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--lib/feed2imap/feed2imap.rb16
2 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a70c07f..5a0b557 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
Feed2Imap 0.9.3 (XX/02/2008)
============================
+* Check the return code from external commands, and warn if != 0. Fixes
+ Gna bug #10516.
Feed2Imap 0.9.2 (28/10/2007)
============================
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index 9a59432..284275a 100644
--- a/lib/feed2imap/feed2imap.rb
+++ b/lib/feed2imap/feed2imap.rb
@@ -121,16 +121,32 @@ class Feed2Imap
if feed.url
s = HTTPFetcher::fetch(feed.url, @cache.get_last_check(feed.name))
elsif feed.execurl
+ # avoid running more than one command at the same time.
+ # We need it because the called command might not be
+ # thread-safe, and we need to get the right exitcode
+ mutex.lock
s = %x{#{feed.execurl}}
+ if $?.exitstatus != 0
+ @logger.warn("Command for #{feed.name} exited with status #{$?.exitstatus} !")
+ end
+ mutex.unlock
else
@logger.warn("No way to fetch feed #{feed.name} !")
end
if feed.filter
+ # avoid running more than one command at the same time.
+ # We need it because the called command might not be
+ # thread-safe, and we need to get the right exitcode.
+ mutex.lock
Open3::popen3(feed.filter) do |stdin, stdout|
stdin.puts s
stdin.close
s = stdout.read
end
+ if $?.exitstatus != 0
+ @logger.warn("Filter command for #{feed.name} exited with status #{$?.exitstatus}. Output might be corrupted !")
+ end
+ mutex.unlock
end
sparefetchers_mutex.synchronize do
sparefetchers += 1