summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pstore.rb11
-rw-r--r--lib/weakref.rb3
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb
index b93420d6499..3f95e8c0598 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -15,7 +15,8 @@
require "marshal"
class PStore
- Exception(:Error)
+ class Error < StandardError
+ end
def initialize(file)
dir = File::dirname(file)
@@ -90,13 +91,17 @@ class PStore
end
ensure
unless @abort
- File::rename @filename, @filename+"~"
+ begin
+ File::rename @filename, @filename+"~"
+ rescue Errno::ENOENT
+ no_orig = true
+ end
begin
File::open(@filename, "w") do |file|
Marshal::dump(@table, file)
end
rescue
- File::rename @filename+"~", @filename
+ File::rename @filename+"~", @filename unless no_orig
end
end
@abort = false
diff --git a/lib/weakref.rb b/lib/weakref.rb
index 6a6dcec5a15..6ef4b422c81 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -12,7 +12,8 @@ require "delegate"
class WeakRef<Delegator
- Exception :RefError
+ class RefError<StandardError
+ end
ID_MAP = {}
ID_REV_MAP = {}