Skip to content

Commit

Permalink
Log file deletion message only if file exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlakshya committed Aug 2, 2019
1 parent 2b0cd82 commit 1af4557
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/webdrivers/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ def delete(file)
max_attempts = 3
attempts_made = 0
delay = 0.5
Webdrivers.logger.debug "Deleting #{file}"

begin
attempts_made += 1
File.delete file if File.exist? file
if File.exist? file
Webdrivers.logger.debug "Deleting #{file}"
File.delete file
end
rescue Errno::EACCES # Solves an intermittent file locking issue on Windows
sleep(delay)
retry if File.exist?(file) && attempts_made <= max_attempts
Expand Down

0 comments on commit 1af4557

Please sign in to comment.