fix deprecared warning with fs.unlink
Since NodeJS 7, call async api without callback is deprecared.
This commit is contained in:
parent
62ef3d91b6
commit
ea4f8474c1
|
@ -18,7 +18,7 @@ function tempFile(str) {
|
||||||
|
|
||||||
function renameTmp(src, dst, _cb) {
|
function renameTmp(src, dst, _cb) {
|
||||||
function cb(err) {
|
function cb(err) {
|
||||||
if (err) fs.unlink(src)
|
if (err) fs.unlink(src, function() {})
|
||||||
_cb(err)
|
_cb(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ function renameTmp(src, dst, _cb) {
|
||||||
var tmp = tempFile(dst)
|
var tmp = tempFile(dst)
|
||||||
fs.rename(dst, tmp, function(err) {
|
fs.rename(dst, tmp, function(err) {
|
||||||
fs.rename(src, dst, cb)
|
fs.rename(src, dst, cb)
|
||||||
if (!err) fs.unlink(tmp)
|
if (!err) fs.unlink(tmp, function () {})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue