MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / command

Method command

pkg/funclet/runtime/runc/runc.go:57–91  ·  view source on GitHub ↗
(args ...string)

Source from the content-addressed store, hash-verified

55)
56
57func (r *RuncConfig) command(args ...string) error {
58 command := r.Command
59 if command == "" {
60 command = DefaultCommand
61 }
62 cmd := exec.Command(command, args...)
63 logs.V(9).Infof("start command %v", cmd.Args)
64 if err := cmd.Start(); err != nil {
65 if exErr, ok := err.(*exec.Error); ok {
66 if exErr.Err == exec.ErrNotFound || exErr.Err == os.ErrNotExist {
67 return fmt.Errorf("runc not installed on system")
68 }
69 }
70 return err
71 }
72
73 if err := cmd.Wait(); err != nil {
74 if sysErr, ok := err.(*os.SyscallError); ok {
75 // ignore error "no child process"
76 if e := sysErr.Err.(syscall.Errno); e == syscall.ECHILD {
77 return nil
78 }
79 } else {
80 logs.Errorf("command [%s] cmd.Wait err %s", cmd.Args, err)
81 }
82 if exitErr, ok := err.(*exec.ExitError); ok {
83 if ws, ok := exitErr.Sys().(syscall.WaitStatus); ok {
84 logs.Errorf("exit code %+v %+v", ws, exitErr)
85 }
86 return fmt.Errorf("runc execution error")
87 }
88 return err
89 }
90 return nil
91}
92
93func (r *RuncConfig) commandOutput(args ...string) (data []byte, err error) {
94 command := r.Command

Callers 8

RunMethod · 0.95
CreateMethod · 0.95
StartMethod · 0.95
DeleteMethod · 0.95
KillMethod · 0.95
UpdateResourceMethod · 0.95
ResumeMethod · 0.95
PauseMethod · 0.95

Calls 6

VFunction · 0.92
ErrorfFunction · 0.92
InfofMethod · 0.80
ErrorfMethod · 0.80
StartMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected