state_file: fsync and binmode
This commit is contained in:
parent
ea17ad4530
commit
2acaaff801
|
@ -94,9 +94,11 @@ module Vagrant
|
|||
# This saves the state back into the state file.
|
||||
def save!
|
||||
Tempfile.open(@path.basename.to_s, @path.dirname.to_s) do |f|
|
||||
f.binmode
|
||||
f.write(JSON.dump(@data))
|
||||
f.chmod(0644)
|
||||
f.fsync
|
||||
f.close
|
||||
f.chmod(0644)
|
||||
FileUtils.mv(f.path, @path)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue