match/lib/match/encrypt.rb in fastlane-2.70.0.beta.20171214010003 vs match/lib/match/encrypt.rb in fastlane-2.70.0.beta.20171215010003

- old
+ new

@@ -91,9 +91,21 @@ command << "-d" unless encrypt command << "&> /dev/null" unless FastlaneCore::Globals.verbose? # to show show an error message is something goes wrong success = system(command.join(' ')) UI.crash!("Error decrypting '#{path}'") unless success + + # On non-Mac systems (more specific Ubuntu Linux) it might take some time for the file to actually be there (see #11182). + # To try to circumvent this flakyness (in tests), we wait a bit until the file appears (max 2s) (usually only 0.1 is actually waited) + unless FastlaneCore::Helper.is_mac? + count = 0 + # sleep until file exists or 20*0.1s (=2s) passed + until File.exist?(tmpfile) || count == 20 + sleep(0.1) + count += 1 + end + end + FileUtils.mv(tmpfile, path) end end end