alwaysai
Version:
The alwaysAI command-line interface (CLI)
39 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const spawner_base_1 = require("./spawner-base");
const gnu_spawner_1 = require("./gnu-spawner");
const resolve_posix_path_1 = require("../util/resolve-posix-path");
const constants_1 = require("../constants");
function SshSpawner(config) {
const resolvePath = resolve_posix_path_1.ResolvePosixPath(config.path);
return gnu_spawner_1.GnuSpawner(Object.assign({ resolvePath }, spawner_base_1.SpawnerBase(translate)));
function translate(cmd) {
const exe = 'ssh';
const args = [
'-i',
constants_1.PRIVATE_KEY_FILE_PATH,
'-o',
'BatchMode=yes',
'-o',
'StrictHostKeyChecking=no',
];
if (cmd.tty) {
args.push('-t');
}
if (cmd.expose5000) {
args.push('-L', '5000:0.0.0.0:5000');
}
args.push(config.hostname, cmd.cwd ? `cd "${resolvePath(cmd.cwd)}" && ${cmd.exe}` : cmd.exe);
if (cmd.args) {
args.push(...cmd.args);
}
const translated = {
exe,
args,
input: cmd.input,
};
return translated;
}
}
exports.SshSpawner = SshSpawner;
//# sourceMappingURL=ssh-spawner.js.map