Skip to content

Commit 55f1907

Browse files
author
Maximilian Frank
committed
Mark in-active files as fully read before skipping them
1 parent 51a88e1 commit 55f1907

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: lib/filewatch/read_mode/processor.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ def process_active(watched_files)
7171
logger.trace(__method__.to_s)
7272
# Handles watched_files in the active state.
7373
watched_files.each do |watched_file|
74-
next unless watched_file.active?
74+
unless watched_file.active?
75+
if @settings.exit_after_read and watched_file.all_read?
76+
# in-active files that have been read completly in a previous run
77+
# need to be marked as such or the pipeline will not end
78+
common_detach_when_allread(watched_file)
79+
end
80+
next
81+
end
7582

7683
begin
7784
restat(watched_file)
@@ -99,7 +106,7 @@ def process_active(watched_files)
99106

100107
def common_detach_when_allread(watched_file)
101108
watched_file.unwatch
102-
watched_file.listener.reading_completed
109+
watched_file.listener.reading_completed unless watched_file.listener.nil?
103110
add_deletable_path watched_file.path
104111
logger.trace? && logger.trace("whole file read, removing from collection", :path => watched_file.path)
105112
end

0 commit comments

Comments
 (0)