Skip to content

Commit

Permalink
fix: output command results
Browse files Browse the repository at this point in the history
  • Loading branch information
burkedavison committed Dec 17, 2024
1 parent eb4876b commit 4271b47
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ func runGenerate(image, apiRoot, output, generatorInput, apiPath string) error {
containerArgs = append(containerArgs, fmt.Sprintf("--api-path=%s", apiPath))
}

ls, err := getCommand("ls", "-la", generatorInput)
_, err := getCommand("ls", "-la", generatorInput)
if err != nil {
return err
}
slog.Info(ls)
runDockerWithEntrypointOverride(image, mounts, "id", []string{})
runDockerWithEntrypointOverride(image, mounts, "ls", []string{"-la"})
runDockerWithEntrypointOverride(image, mounts, "ls", []string{"-la", "/generator-input"})
Expand Down Expand Up @@ -199,9 +198,14 @@ func gid() (string, error) {
return getCommand("id", "-g")
}
func getCommand(c string, args ...string) (string, error) {
out, err := exec.Command(c, args...).Output()
cmd := exec.Command(c, args...)
slog.Info(cmd.String())

out, err := cmd.Output()
if err != nil {
return "", err
}
return string(out[:len(out)-1]), nil
result := string(out[:len(out)-1])
slog.Info(result)
return result, nil
}

0 comments on commit 4271b47

Please sign in to comment.