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:
1 parent
047a3c00f5
commit
3c6cc68086
27 files changed
+75
-107
No files matched your search
@@ -335,9 +335,8 @@ func extractStartCommand(input StartCommandInput) string {
|
||||
}
|
||||
|
||||
resp, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{input.AppName, "DOKKU_START_CMD"},
|
||||
CaptureOutput: true,
|
||||
Trigger: "config-get",
|
||||
Args: []string{input.AppName, "DOKKU_START_CMD"},
|
||||
})
|
||||
if err == nil && resp.ExitCode == 0 && len(resp.Stdout) > 0 {
|
||||
command = strings.TrimSpace(resp.Stdout)
|
||||
@@ -345,9 +344,8 @@ func extractStartCommand(input StartCommandInput) string {
|
||||
|
||||
if input.ImageSourceType == "dockerfile" {
|
||||
resp, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{input.AppName, "DOKKU_DOCKERFILE_START_CMD"},
|
||||
CaptureOutput: true,
|
||||
Trigger: "config-get",
|
||||
Args: []string{input.AppName, "DOKKU_DOCKERFILE_START_CMD"},
|
||||
})
|
||||
if err == nil && resp.ExitCode == 0 && len(resp.Stdout) > 0 {
|
||||
command = strings.TrimSpace(resp.Stdout)
|
||||
|
||||
@@ -43,9 +43,8 @@ func main() {
|
||||
usage()
|
||||
case "help":
|
||||
result, err := common.CallExecCommand(common.ExecCommandInput{
|
||||
Command: "ps",
|
||||
Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())},
|
||||
CaptureOutput: true,
|
||||
Command: "ps",
|
||||
Args: []string{"-o", "command=", strconv.Itoa(os.Getppid())},
|
||||
})
|
||||
if err == nil && strings.Contains(result.StdoutContents(), "--all") {
|
||||
fmt.Println(helpContent)
|
||||
|
||||
@@ -356,10 +356,7 @@ func CommandClusterAdd(role string, remoteHost string, serverIP string, allowUkn
|
||||
|
||||
k3sVersionCmd, err := common.CallExecCommand(common.ExecCommandInput{
|
||||
Command: "k3s",
|
||||
Args: []string{
|
||||
"--version",
|
||||
},
|
||||
CaptureOutput: true,
|
||||
Args: []string{"--version"},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to call k3s version command: %w", err)
|
||||
|
||||
@@ -801,15 +801,13 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
||||
dokkuRmContainer := os.Getenv("DOKKU_RM_CONTAINER")
|
||||
if dokkuRmContainer == "" {
|
||||
resp, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_RM_CONTAINER"},
|
||||
CaptureOutput: true,
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_RM_CONTAINER"},
|
||||
})
|
||||
if err != nil {
|
||||
resp, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get-global",
|
||||
Args: []string{"DOKKU_RM_CONTAINER"},
|
||||
CaptureOutput: true,
|
||||
Trigger: "config-get-global",
|
||||
Args: []string{"DOKKU_RM_CONTAINER"},
|
||||
})
|
||||
if err == nil {
|
||||
dokkuRmContainer = strings.TrimSpace(resp.Stdout)
|
||||
@@ -858,9 +856,8 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
||||
}
|
||||
} else if len(args) == 1 {
|
||||
resp, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "procfile-get-command",
|
||||
Args: []string{appName, args[0], "5000"},
|
||||
CaptureOutput: true,
|
||||
Trigger: "procfile-get-command",
|
||||
Args: []string{appName, args[0], "5000"},
|
||||
})
|
||||
if err == nil && resp.Stdout != "" {
|
||||
common.LogInfo1Quiet(fmt.Sprintf("Found '%s' in Procfile, running that command", args[0]))
|
||||
|
||||
Reference in new issue
Block a user