Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nomad logs command to stream task logs #1444

Merged
merged 16 commits into from
Jul 25, 2016
Prev Previous commit
Next Next commit
small fixes
  • Loading branch information
dadgar committed Jul 25, 2016
commit cbcb32096fb0321a29b6c03ef81c255389ec7a6e
12 changes: 10 additions & 2 deletions command/agent/fs_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,17 @@ func (s *HTTPServer) Stream(resp http.ResponseWriter, req *http.Request) (interf
framer.Run()
defer framer.Destroy()

return nil, s.stream(offset, path, fs, framer, nil)
err := s.stream(offset, path, fs, framer, nil)
if err != nil && err != syscall.EPIPE {
return nil, err
}

return nil, nil
}

// stream is the internal method to stream the content of a file. eofCancelCh is
// used to cancel the stream if triggered while at EOF. If the connection is
// broken an EPIPE error is returned
func (s *HTTPServer) stream(offset int64, path string,
fs allocdir.AllocDirFS, framer *StreamFramer,
eofCancelCh chan error) error {
Expand Down Expand Up @@ -805,7 +813,7 @@ func (s *HTTPServer) logs(follow bool, offset int64,
}

// Check if the connection was closed
if err == syscall.EPIPE {
if strings.Contains(err.Error(), syscall.EPIPE.Error()) {
return nil
}

Expand Down