-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: restrict container detection by pid only when required file…
… exists fix #301 (comment)
- Loading branch information
1 parent
0027f5b
commit 487a27e
Showing
3 changed files
with
70 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
function _pure_detect_container_by_pid_method \ | ||
--description "Linux method to detect container using /proc. see https://stackoverflow.com/a/37015387/802365" | ||
--description "Linux method to detect container using /proc. see https://stackoverflow.com/a/37015387/802365" \ | ||
--argument-names proc_sched | ||
|
||
set --query proc_sched[1]; or set proc_sched /proc/1/sched | ||
|
||
head -n 1 $proc_sched \ | ||
| string match \ | ||
--quiet \ | ||
--invert \ | ||
--regex 'init|systemd' | ||
if test -e $proc_sched | ||
head -n 1 $proc_sched \ | ||
| string match \ | ||
--quiet \ | ||
--invert \ | ||
--regex 'init|systemd' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters