github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/drivers/docker/driver_linux.go (about)

     1  //go:build linux
     2  
     3  package docker
     4  
     5  import (
     6  	"strings"
     7  
     8  	"github.com/opencontainers/runc/libcontainer/cgroups"
     9  )
    10  
    11  func setCPUSetCgroup(path string, pid int) error {
    12  	// Sometimes the container exits before we can write the
    13  	// cgroup resulting in an error which can be ignored.
    14  	err := cgroups.WriteCgroupProc(path, pid)
    15  	if err != nil && strings.Contains(err.Error(), "no such process") {
    16  		return nil
    17  	}
    18  	return err
    19  }