MCPcopy Create free account
hub / github.com/ddev/ddev / Execute

Method Execute

pkg/ddevapp/task.go:80–102  ·  view source on GitHub ↗

Execute (HostTask) executes a command in a container, by default the web container, and returns stdout, stderr, err

()

Source from the content-addressed store, hash-verified

78// Execute (HostTask) executes a command in a container, by default the web container,
79// and returns stdout, stderr, err
80func (c ExecHostTask) Execute() error {
81 cwd, _ := os.Getwd()
82 err := os.Chdir(c.app.GetAppRoot())
83 if err != nil {
84 return err
85 }
86
87 bashPath := "bash"
88 if nodeps.IsWindows() {
89 bashPath = util.FindBashPath()
90 }
91
92 args := []string{
93 "-c",
94 c.exec,
95 }
96
97 err = exec.RunInteractiveCommand(bashPath, args)
98
99 _ = os.Chdir(cwd)
100
101 return err
102}
103
104// Execute (ComposerTask) runs a Composer command in the web container
105// and returns stdout, stderr, err

Callers

nothing calls this directly

Calls 5

IsWindowsFunction · 0.92
FindBashPathFunction · 0.92
RunInteractiveCommandFunction · 0.92
ChdirMethod · 0.80
GetAppRootMethod · 0.80

Tested by

no test coverage detected