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

Method Realtime

cli/pkg/common/exec.go:39–69  ·  view source on GitHub ↗

实时运行

(command string, rootDir string)

Source from the content-addressed store, hash-verified

37
38// 实时运行
39func (eo *execOperation) Realtime(command string, rootDir string) error {
40
41 var execCommand *exec.Cmd
42 switch runtime.GOOS {
43 case "windows":
44 execCommand = exec.Command("powershell", "/c", command)
45 case "darwin":
46 execCommand = exec.Command("bash", "-c", command)
47 case "linux":
48 execCommand = exec.Command("bash", "-c", command)
49 }
50 if rootDir != "" {
51 execCommand.Dir = rootDir
52 }
53
54 currentWorkingDir := ""
55 if execCommand.Dir != "" {
56 currentWorkingDir = fmt.Sprintf("> %v", execCommand.Dir)
57 }
58 SmartIDELog.Debug(fmt.Sprintf("local realtime (%v) exec %v -> %v ",
59 runtime.GOOS, currentWorkingDir, command))
60
61 execCommand.Stdout = os.Stdout
62 execCommand.Stderr = os.Stderr
63 err := execCommand.Run()
64 if err != nil {
65 return err
66 }
67
68 return nil
69}
70
71// 一次性返回结果
72func (eo *execOperation) CombinedOutput(command string, rootDir string) (string, error) {

Callers 5

SparseCheckoutMethod · 0.80
templatesCloneFunction · 0.80
templatesCloneFunction · 0.80
ExecuteStartCmdFunction · 0.80

Calls 2

DebugMethod · 0.80
RunMethod · 0.80

Tested by

no test coverage detected