Skip to content

Commit

Permalink
fix bash script support
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeljkoBenovic committed Nov 18, 2023
1 parent 76aa117 commit 25632dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion aws/ssm/ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ func (s ssm) readBashFileAndProvideCommands() ([]*string, error) {
return nil, err
}

s.log.Debug("Script content read", "content", string(fileBytes))

for _, cmdLine := range strings.Split(string(fileBytes), "\n") {
cmdLine := cmdLine // closure capture
s.log.Debug("Script line read", "line", cmdLine)

cmds = append(cmds, &cmdLine)
}

Expand Down Expand Up @@ -158,7 +163,11 @@ func displayResults(instanceId *string, data *assm.GetCommandInvocationOutput) {
buff.WriteString(*data.StandardErrorContent)
}

buff.WriteString("====================\n\n")
if *data.StandardOutputContent == "" && *data.StandardErrorContent == "" {
buff.WriteString("NO CONTENT TO SHOW\n")
}

buff.WriteString("====================\n")

fmt.Print(buff.String())
}

0 comments on commit 25632dd

Please sign in to comment.