You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
426 B
25 lines
426 B
'use strict';
|
|
const os = require('os');
|
|
const fs = require('fs');
|
|
|
|
const isWsl = () => {
|
|
if (process.platform !== 'linux') {
|
|
return false;
|
|
}
|
|
|
|
if (os.release().includes('Microsoft')) {
|
|
return true;
|
|
}
|
|
|
|
try {
|
|
return fs.readFileSync('/proc/version', 'utf8').includes('Microsoft');
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
if (process.env.__IS_WSL_TEST__) {
|
|
module.exports = isWsl;
|
|
} else {
|
|
module.exports = isWsl();
|
|
}
|
|
|