Skip to content

Commit 0512973

Browse files
authored
Fixed sandbox detection on linux (#33)
1 parent 109a68f commit 0512973

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sandbox.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ func SandboxCpu(cores int) bool {
6262
func SandboxRam(ram_mb int) bool {
6363
var m runtime.MemStats
6464
runtime.ReadMemStats(&m)
65+
ram := m.Sys / 1024
6566
rmb := uint64(ram_mb)
66-
ram := m.TotalAlloc / 1024 / 1024
6767

6868
return ram < rmb
6969
}

sandbox_linux.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import "os"
44

55
func sandboxFilepath() bool {
66
out, _ := cmdOut("systemd-detect-virt")
7-
return out != "none"
7+
if out != "none\n" {
8+
}
9+
return out != "none\n"
810
}
911

1012
// HOTFIX - below function returns false negative, because

0 commit comments

Comments
 (0)