mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Skip process if it has exited
PiperOrigin-RevId: 300802159
This commit is contained in:
committed by
gVisor bot
parent
b8fda7f34f
commit
722abdd833
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user