mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-19 13:39:56 -06:00
36 lines
692 B
JavaScript
36 lines
692 B
JavaScript
const os = require('os')
|
|
const Promise = require('bluebird')
|
|
const getos = Promise.promisify(require('getos'))
|
|
|
|
const getOsVersion = () => {
|
|
return Promise.try(() => {
|
|
if (os.platform() === 'linux') {
|
|
return getos()
|
|
.then((obj) => {
|
|
return [obj.dist, obj.release].join(' - ')
|
|
}).catch(() => {
|
|
return os.release()
|
|
})
|
|
}
|
|
|
|
return os.release()
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
info () {
|
|
return getOsVersion()
|
|
.then((osVersion) => {
|
|
return {
|
|
osName: os.platform(),
|
|
osVersion,
|
|
osCpus: os.cpus(),
|
|
osMemory: {
|
|
free: os.freemem(),
|
|
total: os.totalmem(),
|
|
},
|
|
}
|
|
})
|
|
},
|
|
}
|