alwaysai
Version:
The alwaysAI command-line interface (CLI)
30 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ora = require("ora");
const alwayscli_1 = require("@alwaysai/alwayscli");
const echo_1 = require("../util/echo");
const child_process_1 = require("child_process");
const util_1 = require("util");
const OPENSSH = 'OpenSSH';
async function checkForOpensshComponent() {
const spinner = ora(`Check for OpenSSH-compatible ssh client`).start();
spinner.start();
try {
// Note: ssh -V writes the version string to stderr, not stdout
const output = await util_1.promisify(child_process_1.execFile)('ssh', ['-V'], { encoding: 'utf8' });
if (!output.stderr.startsWith(OPENSSH)) {
throw new Error(`Expected the command "ssh -V" to write a string "${OPENSSH}..." to stderr. Instead got "${output.stderr}" for stderr and "${output.stdout} for stdout"`);
}
spinner.succeed();
}
catch (ex) {
spinner.fail('Command "ssh -V" failed');
echo_1.echo(ex.message);
echo_1.echo();
echo_1.echo(`Please install the ${OPENSSH} suite of secure networking utilities, and make sure that its executables are available on your PATH.`);
echo_1.echo();
throw new alwayscli_1.TerseError('Command "ssh -V" either failed or did not produce the expected result');
}
}
exports.checkForOpensshComponent = checkForOpensshComponent;
//# sourceMappingURL=check-for-openssh-component.js.map