mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
perf: ssh配置增加脚本类型设置,bash还是sh
This commit is contained in:
@@ -543,8 +543,16 @@ export class SshClient {
|
||||
}
|
||||
}
|
||||
|
||||
if (isLinux && options.stopOnError !== false) {
|
||||
script = "set -e\n" + script;
|
||||
if (isLinux) {
|
||||
if (options.connectConf.scriptType == "bash") {
|
||||
script = "#!/usr/bin/env bash \n" + script;
|
||||
} else if (options.connectConf.scriptType == "sh") {
|
||||
script = "#!/bin/sh\n" + script;
|
||||
}
|
||||
|
||||
if (options.connectConf.scriptType != "fish" && options.stopOnError !== false) {
|
||||
script = "set -e\n" + script;
|
||||
}
|
||||
}
|
||||
|
||||
return await conn.exec(script as string, { throwOnStdErr });
|
||||
|
||||
Reference in New Issue
Block a user