Skip to content

Commit 8b01bbd

Browse files
emalmBrandon Shroyer
authored andcommitted
Generalize running_in_container function
This change allows jobs to run correctly in garden-runc containers as well as in the previously supported garden-linux and docker containers. [finishes #136407357, closes #242]
1 parent 9b61459 commit 8b01bbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pid_utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,6 @@ file_must_include() {
182182
}
183183

184184
running_in_container() {
185-
grep -q -E '/instance|/docker/' /proc/self/cgroup
185+
# look for a non-root cgroup
186+
grep --quiet --invert-match ':/$' /proc/self/cgroup
186187
}

0 commit comments

Comments
 (0)