mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-24 08:08:54 -06:00
fix: fix kubernetes container detection (#5681)
This commit is contained in:
@@ -345,10 +345,13 @@ function addDevClientToEntry (config, devClient) {
|
||||
|
||||
// https://stackoverflow.com/a/20012536
|
||||
function checkInContainer () {
|
||||
if ('CODESANDBOX_SSE' in process.env) {
|
||||
return true
|
||||
}
|
||||
const fs = require('fs')
|
||||
if (fs.existsSync(`/proc/1/cgroup`)) {
|
||||
const content = fs.readFileSync(`/proc/1/cgroup`, 'utf-8')
|
||||
return /:\/(lxc|docker|kubepods)\//.test(content)
|
||||
return /:\/(lxc|docker|kubepods(\.slice)?)\//.test(content)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user