You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: output_interceptor_unix.go
    path of file: ./repos/plumber/vendor/github.com/onsi/ginkgo/internal/remote
    
    the code of the file until where you have to start completion: // +build freebsd openbsd netbsd dragonfly darwin linux solaris

package remote

import (
	"errors"
	"io/ioutil"
	"os"

	"github.com/nxadm/tail"
	"golang.org/x/sys/unix"
)

func NewOutputInterceptor() OutputInterceptor {
	return &outputInterceptor{}
}

type outputInterceptor struct {
	redirectFile *os.File
	streamTarget *os.File
	intercepting bool
	tailer       *tail.Tail
	doneTailing  chan bool
}

func (interceptor *outputInterceptor) StartInterceptingOutput() error {
	if interceptor.intercepting {
		return errors.New("Already intercepting output!")
	}
	interceptor.intercepting = true

	var err error

	interceptor.redirectFile, err = ioutil.TempFile("", "ginkgo-output")
	if err != nil {
		return err
	}

	// This might call Dup3 if the dup2 syscall is not available, e.g. on
	// linux/arm64 or linux/riscv64
	unix.Dup2(int(interceptor.redirectFile.Fd()), 1)

    
func (interceptor *outputInterceptor) StartInterceptingOutput() error {
	if interceptor.intercepting {
		return errors.New("Already intercepting output!")
	}
	interceptor.intercepting = true

	var err error

	interceptor.redirectFile, err = ioutil.TempFile("", "ginkgo-output")
	if err != nil {
		return err
	}

	// This might call Dup3 if the dup2 syscall is not available, e.g. on
	// linux/arm64 or linux/riscv64
	unix.Dup2(int(interceptor.redirectFile.Fd()), 1)
	unix.Dup2(int(interceptor.redirectFile.Fd()), 2)

	if interceptor.streamTarget != nil {
		interceptor.tailer, _ = tail.TailFile(interceptor.redirectFile.Name(), tail.Config{Follow: true})
		interceptor.doneTailing = make(chan bool)

		go func() {
			for line := range interceptor.tailer.Lines {
				interceptor.streamTarget.Write([]byte(line.Text + "\n"))
			}
			close(interceptor.doneTailing)
		}()
	}

	return nil
}