Add nil-receiver awareness to all Reader/Writer

This commit is contained in:
Alexander Neumann 2015-05-01 17:13:03 +02:00
parent dbc41bb805
commit 98dc811536
5 changed files with 20 additions and 3 deletions

View file

@ -554,6 +554,10 @@ func (r *SFTP) ID() string {
// Close closes the sftp connection and terminates the underlying command.
func (s *SFTP) Close() error {
if s == nil {
return nil
}
s.c.Close()
// TODO: add timeout after which the process is killed
return s.cmd.Wait()