mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
pstore abort handle
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
50cb050bd7
commit
97f8593cf8
1 changed files with 2 additions and 2 deletions
|
@ -88,14 +88,14 @@ class PStore
|
||||||
file = File::open(@filename, "r+")
|
file = File::open(@filename, "r+")
|
||||||
orig = true
|
orig = true
|
||||||
else
|
else
|
||||||
|
@table = {}
|
||||||
file = File::open(@filename, "w+")
|
file = File::open(@filename, "w+")
|
||||||
|
Marshal::dump(@table, file)
|
||||||
end
|
end
|
||||||
file.flock(File::LOCK_EX)
|
file.flock(File::LOCK_EX)
|
||||||
if orig
|
if orig
|
||||||
File::copy @filename, backup
|
File::copy @filename, backup
|
||||||
@table = Marshal::load(file)
|
@table = Marshal::load(file)
|
||||||
else
|
|
||||||
@table = {}
|
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
catch(:pstore_abort_transaction) do
|
catch(:pstore_abort_transaction) do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue