MCPcopy
hub / github.com/tuna/tunasync / waitExec

Function waitExec

worker/cgroup.go:41–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41func waitExec() {
42 binary, err := exec.LookPath(os.Args[1])
43 if err != nil {
44 panic(err)
45 }
46
47 pipe := os.NewFile(3, "pipe")
48 if pipe != nil {
49 if _, err := pipe.Stat(); err == nil {
50 cmdBytes, err := io.ReadAll(pipe)
51 if err != nil {
52 panic(err)
53 }
54 if err := pipe.Close(); err != nil {
55 }
56 cmd := execCmd(string(cmdBytes))
57 switch cmd {
58 case cmdAbrt:
59 fallthrough
60 default:
61 panic("Exited on request")
62 case cmdCont:
63 }
64 }
65 }
66
67 args := os.Args[1:]
68 env := os.Environ()
69 if err := syscall.Exec(binary, args, env); err != nil {
70 panic(err)
71 }
72 panic("Exec failed.")
73}
74
75func initCgroup(cfg *cgroupConfig) error {
76

Callers

nothing calls this directly

Calls 2

execCmdTypeAlias · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected