Skip process if it has exited

PiperOrigin-RevId: 300802159
This commit is contained in:
Fabricio Voznika
2020-03-13 12:11:13 -07:00
committed by gVisor bot
parent b8fda7f34f
commit 722abdd833
+5
View File
@@ -18,6 +18,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strconv"
@@ -117,6 +118,10 @@ func sandboxPid(pid int) (int, error) {
cmdline, err := ioutil.ReadFile(filepath.Join("/proc", line, "cmdline"))
if err != nil {
if os.IsNotExist(err) {
// Raced with process exit.
continue
}
return 0, err
}
args := strings.SplitN(string(cmdline), "\x00", 2)