refactor: capture output by default

This is almost certainly the correct default for Dokku. While it's a BC break and might cause an increase in memory usage, the api is mostly internal and therefore this is safe to use.
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-12 20:28:31 -05:00
parent 047a3c00f5
commit 3c6cc68086
27 changed files with 75 additions and 107 deletions

View File

@@ -132,9 +132,8 @@ func CopyFromImage(appName string, image string, source string, destination stri
// add trailing newline for certain places where file parsing depends on it
result, err := CallExecCommand(ExecCommandInput{
Command: "tail",
Args: []string{"-c1", destination},
CaptureOutput: true,
Command: "tail",
Args: []string{"-c1", destination},
})
if err != nil || result.ExitCode != 0 {
return fmt.Errorf("Unable to append trailing newline to copied file: %v", result.Stderr)
@@ -243,9 +242,8 @@ func DockerContainerCreate(image string, containerCreateArgs []string) (string,
// DockerInspect runs an inspect command with a given format against a container or image ID
func DockerInspect(containerOrImageID, format string) (output string, err error) {
result, err := CallExecCommand(ExecCommandInput{
Command: DockerBin(),
Args: []string{"inspect", "--format", format, containerOrImageID},
CaptureOutput: true,
Command: DockerBin(),
Args: []string{"inspect", "--format", format, containerOrImageID},
})
if err != nil {
return "", err
@@ -272,9 +270,8 @@ func GetWorkingDir(appName string, image string) string {
func IsComposeInstalled() bool {
result, err := CallExecCommand(ExecCommandInput{
Command: DockerBin(),
Args: []string{"info", "--format", "{{range .ClientInfo.Plugins}}{{if eq .Name \"compose\"}}true{{end}}{{end}}')"},
CaptureOutput: true,
Command: DockerBin(),
Args: []string{"info", "--format", "{{range .ClientInfo.Plugins}}{{if eq .Name \"compose\"}}true{{end}}{{end}}')"},
})
return err == nil && result.ExitCode == 0
}