docs: 自动升级帮助文档

This commit is contained in:
xiaojunnuo
2025-07-11 17:37:33 +08:00
parent 24d3096752
commit 8273031d7e
5 changed files with 87 additions and 20 deletions

View File

@@ -491,7 +491,7 @@ export class SshClient {
* Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\cmd.exe"
* @param options
*/
async exec(options: { connectConf: SshAccess; script: string | Array<string>; env?: any; throwOnStdErr?: boolean }): Promise<string> {
async exec(options: { connectConf: SshAccess; script: string | Array<string>; env?: any; throwOnStdErr?: boolean; stopOnError?: boolean }): Promise<string> {
let { script } = options;
const { connectConf, throwOnStdErr } = options;
@@ -506,6 +506,10 @@ 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) {
@@ -538,6 +542,7 @@ export class SshClient {
script = envScripts.join(newLine) + newLine + script;
}
}
return await conn.exec(script as string, { throwOnStdErr });
},
});