新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
32 lines
558 B
JavaScript
32 lines
558 B
JavaScript
'use strict';
|
|
const os = require('os');
|
|
const fs = require('fs');
|
|
const isDocker = require('is-docker');
|
|
|
|
const isWsl = () => {
|
|
if (process.platform !== 'linux') {
|
|
return false;
|
|
}
|
|
|
|
if (os.release().toLowerCase().includes('microsoft')) {
|
|
if (isDocker()) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
try {
|
|
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ?
|
|
!isDocker() : false;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
if (process.env.__IS_WSL_TEST__) {
|
|
module.exports = isWsl;
|
|
} else {
|
|
module.exports = isWsl();
|
|
}
|