feat: add the check_output_matches plugin #5

Merged
Emmanuel BENOîT merged 16 commits from tseeker/gomonop:20240720-line-matches into master 2024-07-20 22:57:10 +02:00
Showing only changes of commit b8506e8a3f - Show all commits

View file

@ -5,6 +5,7 @@ import (
"context"
"io"
"os/exec"
"strings"
)
// streamObtainer refers to functions that may return either an input stream or
@ -72,7 +73,8 @@ func (pc *pipeCopy) abort() {
// from both stderr and stdout to the dataPipe.
func (pluginInst *matchesPlugin) readFromProgram(ctx context.Context, pipes *readerPipes) {
go func() {
cmd := exec.Command(pluginInst.dataSource) //nolint:gosec // Command is in fact user-provided
args := strings.Split(pluginInst.dataSource, " ")
cmd := exec.Command(args[0], args[1:]...) //nolint:gosec // Command is in fact user-provided
outs := startPipeCopy(func() (io.ReadCloser, error) { return cmd.StdoutPipe() }, pipes)
defer outs.close()