mirror of https://github.com/certd/certd
perf: ssh伪终端模式优化,windows下不开启
parent
8385bcc2d7
commit
42dfe936b7
|
@ -63,16 +63,15 @@ export class SshAccess extends BaseAccess {
|
||||||
})
|
})
|
||||||
passphrase!: string;
|
passphrase!: string;
|
||||||
|
|
||||||
@AccessInput({
|
// @AccessInput({
|
||||||
title: "伪终端",
|
// title: "伪终端",
|
||||||
helper: "如果登录报错:all authentication methods failed,可以尝试开启伪终端模式进行keyboard-interactive方式登录",
|
// helper: "如果登录报错:all authentication methods failed,可以尝试开启伪终端模式进行keyboard-interactive方式登录",
|
||||||
value:false,
|
// component: {
|
||||||
component: {
|
// name: "a-switch",
|
||||||
name: "a-switch",
|
// vModel: "checked",
|
||||||
vModel: "checked",
|
// },
|
||||||
},
|
// })
|
||||||
})
|
// pty!: boolean;
|
||||||
pty = false;
|
|
||||||
|
|
||||||
@AccessInput({
|
@AccessInput({
|
||||||
title: "socks代理",
|
title: "socks代理",
|
||||||
|
|
|
@ -170,9 +170,10 @@ export class AsyncSsh2Client {
|
||||||
// }
|
// }
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.logger.info(`执行命令:[${this.connConf.host}][exec]: \n` + script);
|
this.logger.info(`执行命令:[${this.connConf.host}][exec]: \n` + script);
|
||||||
// pty 必须为false, 否则返回值会带上 所有输出,影响返回结果判断, 比如 root#: xxxx
|
// pty 伪终端,window下的输出会带上conhost.exe之类的多余的字符串,影响返回结果判断
|
||||||
// 当使用keyboard-interactive 登录时,需要pty
|
// linux下 当使用keyboard-interactive 登录时,需要pty
|
||||||
this.conn.exec(script, { pty: this.connConf.pty ?? false, env: opts.env }, (err: Error, stream: any) => {
|
const pty = !this.connConf.windows //linux下开启伪终端,windows下不开启
|
||||||
|
this.conn.exec(script, { pty, env: opts.env }, (err: Error, stream: any) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue