MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / CombinedOutput

Method CombinedOutput

cli/pkg/common/exec.go:72–98  ·  view source on GitHub ↗

一次性返回结果

(command string, rootDir string)

Source from the content-addressed store, hash-verified

70
71// 一次性返回结果
72func (eo *execOperation) CombinedOutput(command string, rootDir string) (string, error) {
73
74 var execCommand *exec.Cmd
75 switch runtime.GOOS {
76 case "windows":
77 execCommand = exec.Command("powershell", "/c", command)
78 case "darwin":
79 execCommand = exec.Command("bash", "-c", command)
80 case "linux":
81 execCommand = exec.Command("bash", "-c", command)
82 }
83 if rootDir != "" {
84 execCommand.Dir = rootDir
85 } else {
86 homeDir, _ := os.UserHomeDir()
87 if homeDir != "" {
88 execCommand.Dir = homeDir
89 }
90 }
91
92 bytes, err := execCommand.CombinedOutput()
93
94 output := strings.TrimSpace(string(bytes))
95 SmartIDELog.Debug(fmt.Sprintf("local combine (%v) exec -> %v >>\n%v", runtime.GOOS, command, output))
96
97 return output, err
98}

Callers 11

GetRemoteNameMethod · 0.80
GetMainBranchNameMethod · 0.80
exeSSHCommandConsoleMethod · 0.80
OpenBrowserFunction · 0.80
IsPortAvailableFunction · 0.80
scanServerPortsFunction · 0.80
GetCliVersionByShellFunction · 0.80

Calls 1

DebugMethod · 0.80

Tested by

no test coverage detected