Skip to content

Commit

Permalink
If a payload exits non-zero, we still want to log the details of its run
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsullivan committed Nov 28, 2016
1 parent a955f16 commit c524909
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,13 @@ func runPayload(wg *sync.WaitGroup, host string, payload []byte, sshConfig *ssh.
}

// finally, run the payload
var sessionRunAttempt string
if err := session.Run(string(payload)); err != nil {
uhoh := fmt.Sprintf("session.Run() to %s failed: %s\n", host, err)
os.Stderr.WriteString(uhoh)
logPayloadRun(host, uhoh)
return
sessionRunAttempt = fmt.Sprintf("session.Run() to %s raised error: %s\n", host, err)
os.Stderr.WriteString(sessionRunAttempt)
}

cmdOutput := stdout.String() + stderr.String()
cmdOutput := stdout.String() + stderr.String() + "\n" + sessionRunAttempt
logPayloadRun(host, cmdOutput)
}

Expand Down

0 comments on commit c524909

Please sign in to comment.