How to use the child_process.promise 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 expo / exp / src / simulator.js View on Github external
async function listSimulatorsAsync() {
  try {
    var output = await child_process.promise.exec('xcrun simctl list devices');
  } catch (e) {
    throw SimulatorNotAvailable(e);
  }

  var lines = output.split("\n");
  var devices = [];

  var runtime;
  for (var line of lines) {
    var m = line.match(/^-- ([^-]+) --$/);
    if (m) {
      runtime = m[1];
      if (runtime.match(/^Unavailable: /)) {
        runtime = undefined;
      }
    }
github expo / exp / build / commands / web.js View on Github external
var ok = yield urlUtil.testUrlAsync(httpUrl);
      } catch (e) {
        throw CommandError('RUN_EXP_START_FIRST', env, 'You may need to run `exp start` to get a URL\n' + e.message);
      } finally {
        simpleSpinner.stop();
      }
      log('OK.');
    }

    log('Opening article in web simulator...');
    console.log();
    console.log(crayon.underline(appetizeUrl));
    console.log();

    if (process.platform === 'darwin') {
      var result = yield child_process.promise.exec('open ' + appetizeUrl, { stdio: 'inherit' });
    } else {
      log.error('Sorry, opening the URL for the web simulator automatically only works on Mac for now.');
    }

    return appetizeUrl;
  }) };
//# sourceMappingURL=../sourcemaps/commands/web.js.map
github expo / exp / src / commands / web.js View on Github external
var ok = await urlUtil.testUrlAsync(httpUrl);
      } catch (e) {
        throw CommandError('RUN_EXP_START_FIRST', env, "You may need to run `exp start` to get a URL\n" + e.message);
      } finally {
        simpleSpinner.stop();
      }
      log("OK.");
    }

    log("Opening article in web simulator...");
    console.log();
    console.log(crayon.underline(appetizeUrl));
    console.log();

    if (process.platform === 'darwin') {
      var result = await child_process.promise.exec("open " + appetizeUrl, {stdio: 'inherit'});
    } else {
      log.error("Sorry, opening the URL for the web simulator automatically only works on Mac for now.");
    }

    return appetizeUrl;

  },
};
github expo / exp / build / simulator.js View on Github external
var listSimulatorsAsync = _asyncToGenerator(function* () {
  try {
    var output = yield child_process.promise.exec('xcrun simctl list devices');
  } catch (e) {
    throw SimulatorNotAvailable(e);
  }

  var lines = output.split('\n');
  var devices = [];

  var runtime;
  for (var line of lines) {
    var m = line.match(/^-- ([^-]+) --$/);
    if (m) {
      runtime = m[1];
      if (runtime.match(/^Unavailable: /)) {
        runtime = undefined;
      }
    }
github expo / exp / src / update.js View on Github external
async function latestExpVersionAsync() {
  var packageName = await jsonFile(path.join(__dirname, '..', 'package.json')).getAsync('name');
  var version_ = await child_process.promise.exec('npm view ' + packageName + ' version');
  return version_.trim();

}
github expo / exp / src / simulator.js View on Github external
async function openUrlOnSimulatorAsync(url) {
  return child_process.promise.exec('xcrun simctl openurl booted ' + JSON.stringify(url));
}
github expo / exp / build / update.js View on Github external
var latestExpVersionAsync = _asyncToGenerator(function* () {
  var packageName = yield jsonFile(path.join(__dirname, '..', 'package.json')).getAsync('name');
  var version_ = yield child_process.promise.exec('npm view ' + packageName + ' version');
  return version_.trim();
});

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