How to use eshost - 3 common examples

To help you get started, we’ve selected a few eshost 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 bterlson / eshost-cli / bin / eshost.js View on Github external
async function runInHost(testable, host) {
  let runner;
  const {
    args: hostArguments,
    path: hostPath,
    type: hostType,
  } = host;
  const shortName = '$262';
  await esh.createAgent(hostType, {
    hostArguments,
    hostPath,
    shortName,
  }).then(r => {
    runner = r;
    return runner.evalScript(testable, {
      async: argv.async || (testable.attrs && testable.attrs.flags && testable.attrs.flags.module),
      module: argv.module || (testable.attrs && testable.attrs.flags && testable.attrs.flags.module)
    });
  }).then(result => {
    reporter.result(host, result);
    return runner.destroy();
  }).catch(e => {
    console.error(chalk.red(`Failure attempting to eval script in agent: ${e.stack}`));
  });
}
github bterlson / eshost-cli / lib / host-manager.js View on Github external
exports.add = function add(config, hostName, hostType, hostPath, hostArgs, hostTags) {
  console.log(chalk.grey(`Using config "${config.configPath}"`));

  if (config.hosts[hostName]) {
    console.log(chalk.red(`Host "${hostName}" already exists`));
    return;
  }

  if (!esh.supportedHosts.includes(hostType)) {
    console.log(
      chalk.red(
        `Host type "${hostType}" not supported. Supported host types are: "${esh.supportedHosts.join(", ")}"`
      )
    );
    return;
  }

  if (hostPath && !path.isAbsolute(hostPath)) {
    hostPath = path.join(process.cwd(), hostPath);
  }

  config.hosts[hostName] = {
    type: hostType,
    path: hostPath,
    args: hostArgs,
github bterlson / eshost-cli / lib / host-manager.js View on Github external
exports.add = function add(config, hostName, hostType, hostPath, hostArgs, hostTags) {
  console.log(chalk.grey(`Using config "${config.configPath}"`));

  if (config.hosts[hostName]) {
    console.log(chalk.red(`Host "${hostName}" already exists`));
    return;
  }

  if (!esh.supportedHosts.includes(hostType)) {
    console.log(
      chalk.red(
        `Host type "${hostType}" not supported. Supported host types are: "${esh.supportedHosts.join(", ")}"`
      )
    );
    return;
  }

  if (hostPath && !path.isAbsolute(hostPath)) {
    hostPath = path.join(process.cwd(), hostPath);
  }

  config.hosts[hostName] = {
    type: hostType,
    path: hostPath,
    args: hostArgs,
    tags: hostTags,
  };
  config.save();

eshost

Invoke ECMAScript scripts in any command line JS engine.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis