1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

AS guide: specifies that renaming a file is atomic on POSIX systems

This commit is contained in:
Xavier Noria 2010-02-07 22:01:54 +01:00
parent 81e779a019
commit d91ac89ab8

View file

@ -2118,7 +2118,7 @@ File.atomic_write(joined_asset_path) do |cache|
end
</ruby>
To accomplish this +atomic_write+ creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed. If the target file exists +atomic_write+ overwrites it and keeps owners and permissions.
To accomplish this +atomic_write+ creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed, which is an atomic operation on POSIX systems. If the target file exists +atomic_write+ overwrites it and keeps owners and permissions.
WARNING. Note you can't append with +atomic_write+.