mirror of https://github.com/certd/certd
fix: 修复ssh无法执行命令的bug
parent
1921a64f4b
commit
9763cb00e5
|
@ -506,10 +506,6 @@ export class SshClient {
|
|||
isWinCmd = await this.isCmd(conn);
|
||||
}
|
||||
|
||||
if (isLinux && options.stopOnError !== false) {
|
||||
script = "set -e\n" + script;
|
||||
}
|
||||
|
||||
if (options.env) {
|
||||
for (const key in options.env) {
|
||||
if (isLinux) {
|
||||
|
@ -525,10 +521,10 @@ export class SshClient {
|
|||
}
|
||||
|
||||
if (isWinCmd) {
|
||||
//组合成&&的形式
|
||||
if (typeof script === "string") {
|
||||
script = script.split("\n");
|
||||
}
|
||||
//组合成&&的形式
|
||||
script = envScripts.concat(script);
|
||||
script = script as Array<string>;
|
||||
script = script.join(" && ");
|
||||
|
@ -543,6 +539,10 @@ export class SshClient {
|
|||
}
|
||||
}
|
||||
|
||||
if (isLinux && options.stopOnError !== false) {
|
||||
script = "set -e\n" + script;
|
||||
}
|
||||
|
||||
return await conn.exec(script as string, { throwOnStdErr });
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue