Skip to content

Commit

Permalink
Copy image into place instead of moving
Browse files Browse the repository at this point in the history
  • Loading branch information
lalcmellkmal committed May 2, 2014
1 parent 7077037 commit b71f1ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 11 additions & 0 deletions etc.js
Expand Up @@ -56,6 +56,17 @@ exports.movex = function (src, dest, callback) {
});
};

exports.cpx = function (src, dest, callback) {
child_process.execFile('/bin/cp', ['-n', '--', src, dest],
function (err, stdout, stderr) {
if (err)
callback(Muggle("Couldn't copy file into place.",
stderr || err));
else
callback(null);
});
};

exports.checked_mkdir = function (dir, cb) {
fs.mkdir(dir, function (err) {
cb(err && err.code == 'EEXIST' ? null : err);
Expand Down
1 change: 0 additions & 1 deletion imager/db.js
Expand Up @@ -146,7 +146,6 @@ O.commit_image_alloc = function (alloc, cb) {
var m = this.connect().multi();
m.del(key);
m.del('lock:' + key);
m.srem('temps', alloc.paths);
m.exec(cb);
};

Expand Down
2 changes: 1 addition & 1 deletion imager/index.js
Expand Up @@ -90,7 +90,7 @@ function publish(alloc, cb) {
}
var dest = media_path(destDir, alloc.image[destKey]);

mvs.push(etc.movex.bind(etc, src, dest));
mvs.push(etc.cpx.bind(etc, src, dest));
}
async.parallel(mvs, cb);
}
Expand Down

0 comments on commit b71f1ca

Please sign in to comment.