Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function rollbackFailure (installList, cb) { return function (er) {
if (!er) return log.verbose(installList.map(function (i) {
return i.join("@")
}).join("\n"), "installed", cb)
// error happened, roll back
installList = installList.map(function (p) {
return (""+p).replace(/\//, '@')
})
npm.ROLLBACK = true
log.error(er, "install failed")
log("rollback", "install failed")
return npm.commands.uninstall
( installList
, function (er_) {
if (er_) log.error(er_, "rollback failed")
else log("rolled back", "install failed")
cb(er)
}
)
}}
function errorHandler(er) {
if (cbCalled) throw new Error('Callback called more than once.');
cbCalled = true;
if (!er) {
itWorked = true;
log.win('ok');
return exit();
}
log.error(er);
if (!(er instanceof Error)) return exit(1);
if (npm2debian.commands[command].usage) {
log.error(npm2debian.commands[command].usage);
}
log.error([
'try running: "npm2debian help ' + command + '"',
'Report this *entire* log at '
].join('\n'));
exit(1);
}
function errorHandler(er) {
if (cbCalled) throw new Error('Callback called more than once.');
cbCalled = true;
if (!er) {
itWorked = true;
log.win('ok');
return exit();
}
log.error(er);
if (!(er instanceof Error)) return exit(1);
if (npm2debian.commands[command].usage) {
log.error(npm2debian.commands[command].usage);
}
log.error([
'try running: "npm2debian help ' + command + '"',
'Report this *entire* log at '
].join('\n'));
exit(1);
}
function errorHandler(er) {
if (cbCalled) throw new Error('Callback called more than once.');
cbCalled = true;
if (!er) {
itWorked = true;
log.win('ok');
return exit();
}
log.error(er);
if (!(er instanceof Error)) return exit(1);
if (npm2debian.commands[command].usage) {
log.error(npm2debian.commands[command].usage);
}
log.error([
'try running: "npm2debian help ' + command + '"',
'Report this *entire* log at '
].join('\n'));
exit(1);
}
process.title = "npm2debian";
var npm2debian = exports,
//set = require("npm/utils/set"),
//get = require("npm/utils/get"),
//ini = require("npm/utils/ini"),
log = require("npm/lib/utils/log"),
fs = require("npm/lib/utils/graceful-fs"),
path = require("path");
npm2debian.commands = {};
if (process.getuid() === 0) {
log.error("\nRunning npm2debian as root is not recommended!\n"
+ "Seriously, don't do this!\n", "sudon't!");
}
try {
var j = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json")) + "");
npm2debian.version = j.version;
npm2debian.nodeVersionRequired = j.engines.node;
} catch (ex) {
log(ex, "error reading version");
npm2debian.version = ex;
}
var commandCache = {};
[ "source", /*"binary", */"help"].forEach(function (c) {
Object.defineProperty(npm2debian.commands, c, {
get : function () {
, function (er_) {
if (er_) log.error(er_, "rollback failed")
else log("rolled back", "install failed")
cb(er)
}
)