How to use the child_process.execSync function in child_process

To help you get started, we’ve selected a few child_process examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-static / react-static / packages / react-static / src / commands / create.js View on Github external
await fs.move(path.join(dest, 'gitignore'), path.join(dest, '.gitignore'))
  }
  if (fs.pathExistsSync(path.join(dest, 'gitignore'))) {
    fs.removeSync(path.join(dest, 'gitignore'))
  }

  if (isCLI) {
    console.log(
      `Installing dependencies with: ${
        isYarn
          ? chalk.hex(ChalkColor.yarn)('Yarn')
          : chalk.hex(ChalkColor.npm)('NPM')
      }...`
    )
    // We install react-static separately to ensure we always have the latest stable release
    execSync(`cd "${name}" && ${isYarn ? 'yarn' : 'npm install'}`)
    console.log('')
  }

  timeEnd(chalk.green(`[\u2713] Project "${name}" created`))

  console.log(`
  ${chalk.green('To get started:')}

    cd "${name}" ${
    !isCLI
      ? `&& ${
          isYarn
            ? chalk.hex(ChalkColor.yarn)('yarn')
            : chalk.hex(ChalkColor.npm)('npm install')
        }`
      : ''
github aurelia / aurelia / test / js-framework-benchmark / webdriver-ts / src / rebuild.ts View on Github external
async function main() {
let frameworks = process.argv.length<=2 ? [] : process.argv.slice(2,process.argv.length);

if (frameworks.length === 0) {
    console.log("usage: rebuild.js [directory1, directory2, ...]");
} else {
    for (let framework of frameworks) {
        let dir = path.resolve(path.join('..','frameworks',framework));
        console.log("rebuilding "+framework+" in directory ", dir);
        if (!fs.existsSync(dir)) throw "ERROR: directory "+dir+" not found";
        else {
            console.log("running rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules");
            try {
                exec('rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules', {
                    cwd: dir,
                    stdio: 'inherit'
                });
            } catch {}
            console.log("running npm install && npm run build-prod");
            exec('npm install && npm run build-prod', {
                cwd: path.resolve(dir),
                stdio: 'inherit'
            });
        }
    }
    exec('npm run index', {
        stdio: 'inherit'
    });

    let frameworkNames = frameworks.join(" ");
github Foundry376 / Mailspring / app / src / linux-theme-utils.ts View on Github external
function convertToPNG(iconName: string, iconPath: string) {
  try {
    const version = execSync('convert --version')
      .toString()
      .trim();
    if (!version) {
      console.warn('Cannot find ImageMagick');
      return null;
    }
    const tmpFile = temp.openSync({ prefix: iconName, suffix: '.png' });
    execSync(`convert ${iconPath} -transparent white ${tmpFile.path}`);
    return tmpFile.path;
  } catch (error) {
    console.warn(error);
  }
  return null;
}
github finos / perspective / scripts / setup.js View on Github external
const execute = cmd => execSync(cmd, {stdio: "inherit"});
github theodi / comma-chameleon / scripts / build.js View on Github external
var filename;
  if (platform === 'linux') {
    filename = platforms[platform][arch];
  } else {
    filename = platforms[platform];
  }

  execSync('curl -L -O --fail https://github.com/theodi/csvlint.sh/releases/download/'+ csvlintVersion +'/' + filename);

  if (platform == "win32") {
    execSync('unzip ' + filename);
    execSync('mv csvlint-'+ csvlintVersion +'-win32/ bin/');
    execSync('rm csvlint-'+ csvlintVersion +'-win32.zip');
  } else {
    execSync('mkdir bin/');
    execSync('tar -zxf '+ filename +' -C bin/ --strip=1');
    execSync('rm csvlint-'+ csvlintVersion +'-*.tar.gz');
  }
};
github NG-ZORRO / ng-zorro-antd-mobile / scripts / publish / publish.js View on Github external
function checkout() {
  log.info('Checkout and push a new branch for publishing...');
  execSync(`git checkout -b publish-${nextVersion}`);
  execSync('git add .');
  execSync(`git commit -m "release(${nextVersion}): release ${nextVersion}"`);
  execSync(`git push origin publish-${nextVersion}`);
  log.success('Please go to GitHub and make a pull request.');
  log.success('Bye!');
}
github Tonejs / Tone.js / scripts / generate_docs.js View on Github external
function generateTypeScriptDefinition(){
	//generate the d.ts file
	execSync(`./node_modules/.bin/jsdoc -c ${resolve(__dirname, "./.tsdoc.json")}`);

	//append an export to the end
	appendFileSync(resolve(__dirname, "../tone.d.ts"), "\nexport = Tone;");
}
github saschwarz / react-svgpathplayer / lib / post_install.js View on Github external
function exec(command) {
  execSync(command, {
    stdio: [0, 1, 2]
  });
}
github ExchangeWorld / ExchangeWorld / script / func.js View on Github external
var job = (str, options) => {

	if (options == null) {
		options = {
			cwd: working_path
		};
	} else {
		if (options.cwd == null) {
			options.cwd = working_path;
		}
	}

	var output = cp.execSync(str, options).toString();

	return output;
};
github volumio / Volumio2 / crashreport.js View on Github external
var moment = require('moment');
var execSync = require('child_process').execSync;
var exec = require('child_process').exec;
var argv = require('yargs').argv;
var logFile = '/tmp/crashdump';
var lastCrashDescription = '/tmp/lastcrash';
var description = 'Unknown';
var fs = require('fs-extra');

if (process.argv[2] != undefined) {
  description = "'" + process.argv[2] + "'";
}
var now = moment().format('YYYY-MM-DD HH:mm');
var sinceTime = moment().subtract(1, 'minutes').format('YYYY-MM-DD HH:mm');
var minuteDump = execSync('/usr/bin/sudo /bin/journalctl --since="' + sinceTime + '" > /tmp/crashdump', {uid: 1000, gid: 1000});
var releaseDump = execSync('cat /etc/os-release >> /tmp/crashdump', {uid: 1000, gid: 1000});
var variant = getVariant();

try {
  var lastReport = fs.readJSONSync(lastCrashDescription, {uid: 1000, gid: 1000}).description;
} catch (e) {
  var lastReport = 'last';
}

if (lastReport != description) {
  sendCrashReport();
}

function sendCrashReport () {
  var command = "/usr/bin/curl -X POST -H 'Content-Type: multipart/form-data'" +
        " -F 'logFile=@" + logFile + "'" +

child_process

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis