Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function directLog(message) {
log.pause();
console.error(message); // eslint-disable-line no-console
log.resume();
}
function confirm(message) {
log.pause();
return inquirer
.prompt([
{
type: "expand",
name: "confirm",
message,
default: 2, // default to help in order to avoid clicking straight through
choices: [
{ key: "y", name: "Yes", value: true },
{ key: "n", name: "No", value: false },
],
},
])
.then(answers => {
log.resume();
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
return
}
running = true
log.pause()
var user = unsafe ? null : npm.config.get("user")
, group = unsafe ? null : npm.config.get("group")
console.log(note)
log.verbose("unsafe-perm in lifecycle", unsafe)
if (process.platform === "win32") {
unsafe = true
}
if (unsafe) {
runCmd_(cmd, pkg, env, wd, stage, unsafe, 0, 0, cb)
} else {
uidNumber(user, group, function (er, uid, gid) {
runCmd_(cmd, pkg, env, wd, stage, unsafe, uid, gid, cb)
})
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
return
}
running = true
log.pause()
var user = unsafe ? null : npm.config.get("user")
, group = unsafe ? null : npm.config.get("group")
if (log.level !== 'silent') {
if (npm.spinner.int) {
npm.config.get("logstream").write("\r \r")
}
console.log(note)
}
log.verbose("unsafe-perm in lifecycle", unsafe)
if (process.platform === "win32") {
unsafe = true
}
if (unsafe) {
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
return
}
running = true
log.pause()
var user = unsafe ? null : npm.config.get("user")
, group = unsafe ? null : npm.config.get("group")
console.log(note)
log.verbose("unsafe-perm in lifecycle", unsafe)
if (process.platform === "win32") {
unsafe = true
}
if (unsafe) {
runCmd_(cmd, pkg, env, wd, stage, unsafe, 0, 0, cb)
} else {
uidNumber(user, group, function (er, uid, gid) {
runCmd_(cmd, pkg, env, wd, stage, unsafe, uid, gid, cb)
})
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
return
}
running = true
log.pause()
var user = unsafe ? null : npm.config.get("user")
, group = unsafe ? null : npm.config.get("group")
if (log.level !== 'silent') {
console.log(note)
}
log.verbose("unsafe-perm in lifecycle", unsafe)
if (process.platform === "win32") {
unsafe = true
}
if (unsafe) {
runCmd_(cmd, pkg, env, wd, stage, unsafe, 0, 0, cb)
} else {
uidNumber(user, group, function (er, uid, gid) {
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
return
}
running = true
log.pause()
var user = unsafe ? null : npm.config.get("user")
, group = unsafe ? null : npm.config.get("group")
if (log.level !== 'silent') {
if (npm.spinner.int) {
npm.config.get("logstream").write("\r \r")
}
console.log(note)
}
log.verbose("unsafe-perm in lifecycle", unsafe)
if (process.platform === "win32") {
unsafe = true
}
if (unsafe) {
function input(message, { filter, validate } = {}) {
log.pause();
return inquirer
.prompt([
{
type: "input",
name: "input",
message,
filter,
validate,
},
])
.then(answers => {
log.resume();
return answers.input;
});