chore: support Multiline SSH commands interpreted as single lines (#160)

https://github.com/appleboy/ssh-action/issues/75
This commit is contained in:
Bo-Yi Wu
2020-08-08 15:31:57 +08:00
committed by GitHub
parent 77a818a94d
commit 66bbf9b7cd
2 changed files with 13 additions and 1 deletions
+2 -1
View File
@@ -207,11 +207,12 @@ func (p Plugin) scriptCommands() []string {
commands := make([]string, 0)
for _, cmd := range scripts {
cmd = strings.TrimSpace(cmd)
if strings.TrimSpace(cmd) == "" {
continue
}
commands = append(commands, cmd)
if p.Config.ScriptStop {
if p.Config.ScriptStop && cmd[(len(cmd)-1):] != "\\" {
commands = append(commands, "DRONE_SSH_PREV_COMMAND_EXIT_CODE=$? ; if [ $DRONE_SSH_PREV_COMMAND_EXIT_CODE -ne 0 ]; then exit $DRONE_SSH_PREV_COMMAND_EXIT_CODE; fi;")
}
}