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.
|
# This saves the state back into the state file.
|
||||||
def save!
|
def save!
|
||||||
Tempfile.open(@path.basename.to_s, @path.dirname.to_s) do |f|
|
Tempfile.open(@path.basename.to_s, @path.dirname.to_s) do |f|
|
||||||
|
f.binmode
|
||||||
f.write(JSON.dump(@data))
|
f.write(JSON.dump(@data))
|
||||||
f.chmod(0644)
|
f.fsync
|
||||||
f.close
|
f.close
|
||||||
|
f.chmod(0644)
|
||||||
FileUtils.mv(f.path, @path)
|
FileUtils.mv(f.path, @path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue