Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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}`));
});
}