毕设专用git仓库
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.

28 lines
572 B

import process from 'node:process';
import os from 'node:os';
import fs from 'node:fs';
import isInsideContainer from 'is-inside-container';
const isWsl = () => {
if (process.platform !== 'linux') {
return false;
}
if (os.release().toLowerCase().includes('microsoft')) {
if (isInsideContainer()) {
return false;
}
return true;
}
try {
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')
? !isInsideContainer() : false;
} catch {
return false;
}
};
export default process.env.__IS_WSL_TEST__ ? isWsl : isWsl();