Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fixes #1105, logging plugin's response to stdout on plugin load error
Browse files Browse the repository at this point in the history
  • Loading branch information
katarzyna-z committed Mar 9, 2017
1 parent 0b2c031 commit fa80d3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion control/plugin/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) {
respReceived bool
resp Response
err error
respBytes []byte
)

doneChan := make(chan struct{})
Expand All @@ -125,7 +126,7 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) {
// handshake. Once we've received that, we can begin to forward
// logs on to snapteld's log.
if !respReceived {
respBytes := stdOutScanner.Bytes()
respBytes = stdOutScanner.Bytes()
err = json.Unmarshal(respBytes, &resp)
respReceived = true
close(doneChan)
Expand Down Expand Up @@ -168,6 +169,10 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) {
err = fmt.Errorf("timed out waiting for plugin %s", path.Base(e.cmd.Path()))
}
if err != nil {
execLogger.WithFields(log.Fields{
"received_response": string(respBytes),
}).Error("error loading plugin")

// Kill the plugin if we failed to load it.
e.Kill()
}
Expand Down

0 comments on commit fa80d3f

Please sign in to comment.