Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) {
try {
fs.unlink(testNodeDir)
} catch (err) {
t.error(err)
}
var logLines = stderr.toString().trim().split(/\r?\n/)
var lastLine = logLines[logLines.length - 1]
t.strictEqual(err, null)
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok')
t.strictEqual(runHello().trim(), 'world')
})
proc.stdout.setEncoding('utf-8')
async.each(posts, function(post, next){
fs.unlink(post, next);
}, function(err){
posts.length = 0;
function rmFile (file, done) {
fs.unlink(file, function (err) {
if (err) return onError(err)
return done()
})
}
function rmFile(file, done) {
fs.unlink(file, function (err) {
if (err) {
return onError(err)
}
return done()
})
}
db.load(dbPath, function(err){
if (!err) return next();
hexo.log.e('Database load failed. Deleting database.');
fs.unlink(dbPath, next);
});
});
fs.link(src, dest, err => {
if (err) {
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM' || err.code === 'ENOTSUP') {
return moveAcrossDevice(src, dest, overwrite, callback)
}
return callback(err)
}
return fs.unlink(src, callback)
})
}
fs.link(source, dest, function (err) {
if (err) {
if (err.code === 'EXDEV' || err.code === 'EISDIR' || err.code === 'EPERM') {
moveAcrossDevice(source, dest, clobber, limit, callback)
return
}
callback(err)
return
}
fs.unlink(source, callback)
})
}
if (!(stat && (stat.isDirectory() || stat.isSymbolicLink() || stat.isFile()))) {
log(leaf, 'is not a directory, file, or link')
return cb(new Error(leaf + ' is not a directory, file, or link'))
}
if (options.purge) {
log('purging', leaf)
rimraf(leaf, function (error) {
if (error) return cb(error)
next(dirname(leaf))
})
} else if (!stat.isDirectory()) {
log('removing', leaf)
unlink(leaf, function (error) {
if (error) return cb(error)
next(dirname(leaf))
})
} else {
next(leaf)
}
})
searchables.forEach(asset => {
fs.unlink(assetManager.UPLOAD_DEST + asset.filename, () => {});
});
function onClose () {
fs.unlink(source, callback)
}
}