Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function install(cmd, name, argv) {
argv = argv.slice();
var result = getInstallDir(argv);
argv = result.argv;
var installPath = getInstallPath(getTempName(name), result.dir);
fse.ensureDirSync(installPath);
fse.emptyDirSync(installPath);
fs.writeFileSync(path.join(installPath, 'package.json'), PACKAGE_JSON);
fs.writeFileSync(path.join(installPath, 'LICENSE'), LICENSE);
fs.writeFileSync(path.join(installPath, 'README.md'), RESP_URL);
argv.unshift('install', name);
cp.spawn(cmd, argv, {
stdio: 'inherit',
cwd: installPath
}).on('exit', function(code) {
if (code) {
removeDir(installPath);
} else {
var realPath = getInstallPath(name, result.dir);
removeDir(realPath);
try {
fs.renameSync(installPath, realPath);
} catch (e) {