package services

import "io"

type joinedReadCloser struct {
	io.ReadCloser
	close func()
}

func closeWith(source io.ReadCloser, close func()) io.ReadCloser {
	return joinedReadCloser{ReadCloser: source, close: close}
}

func (c joinedReadCloser) Close() error {
	err := c.ReadCloser.Close()
	c.close()
	return err
}
