diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2008-04-03 12:14:08 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2008-04-03 12:14:08 +0000 |
commit | eca21af74910ed2f325fd72c9a5038d8eff6b37d (patch) | |
tree | d87809dc1ce2938b2e71c7c863c316c6802b712f | |
parent | 2dfce94953d8eb3e193842903a63a9d12fd8c4af (diff) | |
download | feed2imap-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 '')
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 16 |
2 files changed, 18 insertions, 0 deletions
@@ -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 |