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

Method GetPidFromFile

pkg/funclet/reset.go:276–291  ·  view source on GitHub ↗
(containerID string)

Source from the content-addressed store, hash-verified

274}
275
276func (f *Funclet) GetPidFromFile(containerID string) (pid int, err error) {
277 paths, err := f.PathManager.GetPaths(containerID)
278 if err != nil {
279 return 0, err
280 }
281 path := filepath.Join(paths.RunnerSpecPath, "runner.pid")
282 d, err := ioutil.ReadFile(path)
283 if err != nil {
284 return 0, err
285 }
286 pid, err = strconv.Atoi(string(bytes.TrimSpace(d)))
287 if err != nil {
288 return 0, fmt.Errorf("error parsing pid from %s: %s", path, err)
289 }
290 return pid, nil
291}
292
293func (f *Funclet) RemoveTmpDevice(ctx *funcletCtx.Context, pathName string) {
294 if err := f.TmpManager.RemoveTmpStorage(pathName); err != nil {

Callers 1

ResetContainerMethod · 0.95

Calls 2

ErrorfMethod · 0.80
GetPathsMethod · 0.65

Tested by

no test coverage detected