diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-08-27 16:24:47 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-08-27 16:24:47 -0300 |
commit | 90f5a852a6168661ece21f0918ea56d41c8b50ce (patch) | |
tree | 6864754c5e6f085ab51ee35bb8d1e6e530cab28f | |
parent | 15d99158f18777e8585bd779c5d95b9842f1393b (diff) | |
download | luarocks-90f5a852a6168661ece21f0918ea56d41c8b50ce.tar.gz luarocks-90f5a852a6168661ece21f0918ea56d41c8b50ce.tar.bz2 luarocks-90f5a852a6168661ece21f0918ea56d41c8b50ce.zip |
Let's try to make manifest writing more atomic, and see if this is an improvement for #54.
-rw-r--r-- | src/luarocks/manif.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 60b0c1df..6b05b749 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
@@ -31,7 +31,11 @@ local function save_table(where, name, tbl) | |||
31 | assert(type(tbl) == "table") | 31 | assert(type(tbl) == "table") |
32 | 32 | ||
33 | local filename = dir.path(where, name) | 33 | local filename = dir.path(where, name) |
34 | return persist.save_from_table(filename, tbl) | 34 | local ok, err = persist.save_from_table(filename..".tmp", tbl) |
35 | if ok then | ||
36 | ok, err = os.rename(filename..".tmp", filename) | ||
37 | end | ||
38 | return ok, err | ||
35 | end | 39 | end |
36 | 40 | ||
37 | function load_rock_manifest(name, version, root) | 41 | function load_rock_manifest(name, version, root) |