Skip to content

Commit 572ffaf

Browse files
authored
chore: retain note in code about file locking on pact update
1 parent 9db787d commit 572ffaf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/pact/consumer_contract/consumer_contract_writer.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def update_pactfile_if_needed
5959
def update_pactfile
6060
logger.info log_message
6161
FileUtils.mkdir_p File.dirname(pactfile_path)
62-
# update a counter using write lock
63-
# don't use "w" because it truncates the file before lock.
62+
# must be read after obtaining the lock, and must be read from the yielded file object, otherwise windows freaks out
6463
# https://apidock.com/ruby/File/flock
6564
File.open(pactfile_path, File::RDWR|File::CREAT, 0644) {|pact_file|
6665
pact_file.flock(File::LOCK_EX)

0 commit comments

Comments
 (0)