feat: prevent stdout close

This commit is contained in:
wpetit 2022-08-01 17:13:02 +02:00 committed by Bornholm
parent bbdfb30205
commit 1c770b7413
1 changed files with 13 additions and 1 deletions

View File

@ -15,9 +15,21 @@ func (h *UpdaterHandler) Match(url *url.URL) bool {
} }
func (u *UpdaterHandler) Update(url *url.URL) (io.WriteCloser, error) { func (u *UpdaterHandler) Update(url *url.URL) (io.WriteCloser, error) {
return os.Stdout, nil return &stdoutFakeCloser{}, nil
} }
func NewUpdaterHandler() *UpdaterHandler { func NewUpdaterHandler() *UpdaterHandler {
return &UpdaterHandler{} return &UpdaterHandler{}
} }
type stdoutFakeCloser struct {
io.WriteCloser
}
func (c *stdoutFakeCloser) Write(p []byte) (n int, err error) {
return os.Stdout.Write(p)
}
func (c *stdoutFakeCloser) Close() error {
return nil
}