How to use the mz/child_process.execFile function in mz

To help you get started, we’ve selected a few mz 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 fontello / fontello / lib / system / init / server.js View on Github external
worker.on('online', co.wrap(function* () {
    try {
      // Set scheduling policy to SCHED_IDLE (`-i` flag);
      // `0` is only possible value for priority ('cause this policy doesn't allow to set it)
      yield execFile('chrt', [ '-i', '-p', '0', worker.process.pid ]);
    } catch (__) {
      // If `chrt` not exists, try fallback to `renice`.
      try {
        yield execFile('renice', [ '-n', '19', '-p', worker.process.pid ]);
        log.warn('Cannot set scheduling policy for queue using `chrt`, falling back to `renice`');
      } catch (___) {
        log.error('Cannot lower priority for queue ' +
          '(both `renice` and `chrt` have failed), continuing with default priority');
      }
    }
  }));
github tableflip / guvnor / lib / operations / darwin / find-group-details.js View on Github external
const darwinFindGroupDetails = (context, nameOrId) => {
  // in dscl, everything is a string
  nameOrId = `${nameOrId}`

  return execFile('dscl', ['-plist', '.', 'readall', '/groups', 'PrimaryGroupID', 'RecordName', 'GroupMembership'])
  .then(([stdout]) => plist.parse(stdout))
  .then(groups => groups.filter(group => plistValue(group, 'dsAttrTypeStandard:PrimaryGroupID') === nameOrId))
  .then(groups => groups.pop())
  .then(group => {
    return {
      name: plistValue(group, 'dsAttrTypeStandard:RecordName'),
      gid: parseInt(plistValue(group, 'dsAttrTypeStandard:PrimaryGroupID'), 10),
      members: group['dsAttrTypeStandard:GroupMembership']
    }
  })
}
github tableflip / guvnor / test / browser / fixtures / configure-browser.js View on Github external
.then(pk12util => {
    logger.debug('Installing certificate')
    logger.debug(pk12util, '-i', p12Path, '-d', profileDirectory, '-W', password)

    return execFile(pk12util, ['-i', p12Path, '-d', profileDirectory, '-W', password])
  })
}
github resugar / resugar / script / update-website.ts View on Github external
async function run(command: string, args: Array): Promise<{ stdout: string, stderr: string }> {
  let [ stdout, stderr ] = await execFile(command, args);
  return { stdout, stderr };
}
github balena-io-modules / drivelist / lib / lsblk / index.ts View on Github external
async function getOutput(command: string, ...args: string[]) {
	const [stdout] = await execFile(command, args);
	return stdout;
}
github tableflip / guvnor / lib / operations / posix / get-os.js View on Github external
const getOs = (context) => {
  if (!promise) {
    promise = execFile('uname', ['-a'])
    .then(result => {
      const stdout = result[0].toLowerCase()

      if (stdout.indexOf('centos') !== -1) {
        return 'centos'
      } else if (stdout.indexOf('darwin') !== -1) {
        return 'darwin'
      } else if (stdout.indexOf('debian') !== -1) {
        return 'debian'
      } else if (stdout.indexOf('fedora') !== -1) {
        return 'fedora'
      } else if (stdout.indexOf('freebsd') !== -1) {
        return 'freebsd'
      } else if (stdout.indexOf('mint') !== -1) {
        return 'mint'
      } else if (stdout.indexOf('netbsd') !== -1) {
github tableflip / guvnor / lib / operations / launchd / stop-process.js View on Github external
const launchdStopProcess = (context, name) => {
  const plist = path.join(config.PLIST_LOCATIONS, `${config.DAEMON_NAME}.${name}.plist`)

  context.log([DEBUG, CONTEXT], `running launchctl unload -w ${plist}`)

  return execFile(config.LAUNCHCTL_PATH, ['unload', '-w', plist])
  .then(([stdout, stderr]) => {
    if (stdout) {
      context.log([DEBUG, CONTEXT], stdout.trim())
    }

    if (stderr) {
      context.log([WARN, CONTEXT], stderr.trim())
    }

    return operations.findProcess(context, name)
  })
}
github decaffeinate / decaffeinate / script / update-website.ts View on Github external
async function run(command: string, args: Array): Promise<{ stdout: string; stderr: string }> {
  const [stdout, stderr] = await execFile(command, args);
  return { stdout, stderr };
}