MCPcopy
hub / github.com/cortesi/modd / RunProc

Function RunProc

prep.go:25–41  ·  view source on GitHub ↗

RunProc runs a process to completion, sending output to log

(cmd string, shellMethod string, dir string, log termlog.Stream)

Source from the content-addressed store, hash-verified

23
24// RunProc runs a process to completion, sending output to log
25func RunProc(cmd string, shellMethod string, dir string, log termlog.Stream) error {
26 log.Header()
27 ex, err := shell.NewExecutor(shellMethod, cmd, dir)
28 if err != nil {
29 return err
30 }
31 start := time.Now()
32 err, estate := ex.Run(log, true)
33 if err != nil {
34 return err
35 } else if estate.Error != nil {
36 log.Shout("%s", estate.Error)
37 return ProcError{estate.Error.Error(), estate.ErrOutput}
38 }
39 log.Notice(">> done (%s)", time.Since(start))
40 return nil
41}
42
43// RunPreps runs all commands in sequence. Stops if any command returns an error.
44func RunPreps(

Callers 1

RunPrepsFunction · 0.85

Calls 2

RunMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected