Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eshost-cli

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eshost-cli - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

lib/Reporter.js

50

bin/eshost.js

@@ -11,2 +11,5 @@ #!/usr/bin/env node

const hostManager = require('../lib/host-manager.js') ;
const Table = require('cli-table');
const DefaultReporter = require('../lib/reporters/default.js');
const TableReporter = require('../lib/reporters/table.js');

@@ -29,4 +32,12 @@ const usage = `

.alias('c', 'config')
.describe('table', 'output in a table')
.boolean('table')
.alias('table', 't')
.describe('coalesce', 'coalesce like output into a single entry')
.boolean('coalesce')
.describe('showSource', 'show input source')
.boolean('showSource')
.nargs('h', 1)
.boolean('async', 'wait for realm destruction before reporting results')
.describe('async', 'wait for realm destruction before reporting results')
.boolean('async')
.alias('a', 'async')

@@ -74,2 +85,17 @@ .boolean('l', 'list hosts')

let reporterOptions = {
showSource: argv.showSource,
coalesce: argv.coalesce
};
if (argv.showSource) {
reporterOptions.showSource = true;
}
let reporter;
if (argv.table) {
reporter = new TableReporter(reporterOptions);
} else {
reporter = new DefaultReporter(reporterOptions);
}
// list available hosts

@@ -132,3 +158,3 @@ if (argv.list) {

let runner;
esh.createAgent(host.type, { hostArguments: host.args, hostPath: host.path })
return esh.createAgent(host.type, { hostArguments: host.args, hostPath: host.path })
.then(r => {

@@ -139,8 +165,7 @@ runner = r;

.then(function (result) {
printHostResult(host.name, result);
reporter.result(host, result);
return runner.destroy();
})
.catch(e => {
console.error(chalk.red('Failure attempting to eval script in agent: ' + e.message));
console.error(chalk.red('Failure attempting to eval script in agent: ' + e.stack));
})

@@ -150,18 +175,11 @@ }

function runInEachHost(code, hosts) {
hosts.forEach(name => {
reporter.start(code);
let promises = hosts.map(name => {
const host = config.hosts[name];
host.name = name;
runInHost(host, code);
return runInHost(host, code);
});
}
function printHostResult(name, result) {
console.log(chalk.blue(`#### ${name}`));
console.log(result.stdout.trim());
if (result.error) {
console.log(chalk.red(`${result.error.name}: ${result.error.message}`));
}
console.log("");
Promise.all(promises).then(() => reporter.end());
}
{
"name": "eshost-cli",
"version": "3.0.1",
"version": "3.1.0",
"description": "Run scripts in any ECMAScript host",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc