mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-23 12:30:33 +01:00
Most potential deadlock problems should have been fixed, and new code is unlikely to cause new problems with the new design. Also raise the minimum Git version required to 2.6.0 (released in 2015)
80 lines
1.2 KiB
Go
80 lines
1.2 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package gitcmd
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
type PipeBufferReader interface {
|
|
Read(p []byte) (n int, err error)
|
|
Bytes() []byte
|
|
}
|
|
|
|
type PipeBufferWriter interface {
|
|
Write(p []byte) (n int, err error)
|
|
Bytes() []byte
|
|
}
|
|
|
|
type PipeReader interface {
|
|
io.ReadCloser
|
|
internalOnly()
|
|
}
|
|
|
|
type pipeReader struct {
|
|
f *os.File
|
|
}
|
|
|
|
func (r *pipeReader) internalOnly() {}
|
|
|
|
func (r *pipeReader) Read(p []byte) (n int, err error) {
|
|
return r.f.Read(p)
|
|
}
|
|
|
|
func (r *pipeReader) Close() error {
|
|
return r.f.Close()
|
|
}
|
|
|
|
type PipeWriter interface {
|
|
io.WriteCloser
|
|
internalOnly()
|
|
}
|
|
|
|
type pipeWriter struct {
|
|
f *os.File
|
|
}
|
|
|
|
func (w *pipeWriter) internalOnly() {}
|
|
|
|
func (w *pipeWriter) Close() error {
|
|
return w.f.Close()
|
|
}
|
|
|
|
func (w *pipeWriter) Write(p []byte) (n int, err error) {
|
|
return w.f.Write(p)
|
|
}
|
|
|
|
func (w *pipeWriter) DrainBeforeClose() error {
|
|
return nil
|
|
}
|
|
|
|
type pipeNull struct {
|
|
err error
|
|
}
|
|
|
|
func (p *pipeNull) internalOnly() {}
|
|
|
|
func (p *pipeNull) Read([]byte) (n int, err error) {
|
|
return 0, p.err
|
|
}
|
|
|
|
func (p *pipeNull) Write([]byte) (n int, err error) {
|
|
return 0, p.err
|
|
}
|
|
|
|
func (p *pipeNull) Close() error {
|
|
return nil
|
|
}
|