chore: remove all direct usage of go-sh outside of plugin trigger setup

The new way is to use CallExecCommand instead.
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-12 19:28:23 -05:00
parent 688ee518af
commit 8a940c6e47
11 changed files with 99 additions and 99 deletions

View File

@@ -3,7 +3,6 @@ module github.com/dokku/dokku/plugins/ps
go 1.21
require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
@@ -14,6 +13,7 @@ require (
require (
github.com/alexellis/go-execute/v2 v2.2.1 // indirect
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect

View File

@@ -9,7 +9,6 @@ import (
"strconv"
"strings"
sh "github.com/codeskyblue/go-sh"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config"
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
@@ -103,8 +102,17 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
}
}
if b, err := sh.Command("procfile-util", "check", "-P", processSpecificProcfile).CombinedOutput(); err != nil {
return fmt.Errorf(strings.TrimSpace(string(b[:])))
result, err := common.CallExecCommand(common.ExecCommandInput{
Command: "procfile-util",
Args: []string{"check", "-P", processSpecificProcfile},
CaptureOutput: true,
StreamStdio: false,
})
if err != nil {
return fmt.Errorf(result.StderrContents())
}
if result.ExitCode != 0 {
return fmt.Errorf("Invalid Procfile: %s", result.StderrContents())
}
return nil
}