Skip to content

Commit

Permalink
fix: fix kubernetes container detection (#5681)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbogdan committed Jul 19, 2020
1 parent c98f76a commit ddabb66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@vue/cli-service/lib/commands/serve.js
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit ddabb66

Please sign in to comment.