summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2008-04-03 12:14:08 +0000
committerlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2008-04-03 12:14:08 +0000
commiteca21af74910ed2f325fd72c9a5038d8eff6b37d (patch)
treed87809dc1ce2938b2e71c7c863c316c6802b712f /lib
parent2dfce94953d8eb3e193842903a63a9d12fd8c4af (diff)
downloadfeed2imap-eca21af74910ed2f325fd72c9a5038d8eff6b37d.tar.gz
feed2imap-eca21af74910ed2f325fd72c9a5038d8eff6b37d.tar.bz2
feed2imap-eca21af74910ed2f325fd72c9a5038d8eff6b37d.zip
fix for gna 10516
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@144 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to 'lib')
-rw-r--r--lib/feed2imap/feed2imap.rb16
1 files changed, 16 insertions, 0 deletions
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