Skip to content

Commit

Permalink
fix executor
Browse files Browse the repository at this point in the history
  • Loading branch information
et-nik committed Feb 25, 2024
1 parent 28c6cd9 commit fe7171f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/app/components/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"

"github.com/gameap/daemon/internal/app/contracts"
"github.com/gameap/daemon/pkg/shellquote"
Expand Down Expand Up @@ -115,7 +116,14 @@ func ExecWithWriter(
return invalidResult, errors.Wrap(err, "executable file not found")
}

cmd := exec.CommandContext(ctx, args[0], args[1:]...) //nolint:gosec
filteredArgs := make([]string, 0, len(args))
for _, arg := range args[1:] {
if arg != "" {
filteredArgs = append(filteredArgs, strings.TrimSpace(arg))
}
}

cmd := exec.CommandContext(ctx, name, filteredArgs...) //nolint:gosec
cmd.Dir = workDir
cmd.Stdout = out
cmd.Stderr = out
Expand Down

0 comments on commit fe7171f

Please sign in to comment.