agent: shutdown delegate if created

When the TestAgent shuts down a half-started agent
the delegate may not have been created at this point.
pull/3037/head
Frank Schroeder 8 years ago
parent 632f837c98
commit e16589c079
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD

@ -1011,8 +1011,11 @@ func (a *Agent) Shutdown() error {
chk.Stop()
}
err := a.delegate.Shutdown()
a.logger.Print("[DEBUG] agent: delegate down")
var err error
if a.delegate != nil {
err = a.delegate.Shutdown()
a.logger.Print("[DEBUG] agent: delegate down")
}
pidErr := a.deletePid()
if pidErr != nil {

Loading…
Cancel
Save