Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error = new Error(
'lazy-require: cannot save the module as `opts.cwd` did not contain a `package.json` file'
)
}
// Install
else {
// Arguments
const args = ['npm', 'install', name]
if (opts.save === true) {
args.push('--save')
opts.save = null // {delete opts.save} is very slow
}
// Install
safeps.spawn(args, opts, function(err) {
// Check
if (err) return next(err)
// Try to load the module
lazyRequire.require(name, opts, next)
})
// Exit
return null
}
// Complete
return complete(error, null, next)
}
return new Promise(function(resolve, reject) {
safeps.spawn(command, opts, function(err, stdout) {
if (err)
return reject(new Errlop(`spawn failed: ${command.join(' ')}`, err))
return resolve(stdout)
})
})
}
startLocalDocPadExecutable: function(next) {
var args, command;
args = process.argv.slice(2);
command = ['node', docpadUtil.getLocalDocPadExecutable()].concat(args);
return require('safeps').spawn(command, {
stdio: 'inherit'
}, function(err) {
var message;
if (err) {
if (next) {
return next(err);
} else {
message = 'An error occured within the child DocPad instance: ' + err.message + '\n';
return process.stderr.write(message);
}
} else {
return typeof next === "function" ? next() : void 0;
}
});
},
getBasename: function(filename) {