mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
26 lines
452 B
JavaScript
26 lines
452 B
JavaScript
'use strict';
|
|
const os = require('os');
|
|
const fs = require('fs');
|
|
|
|
const isWsl = () => {
|
|
if (process.platform !== 'linux') {
|
|
return false;
|
|
}
|
|
|
|
if (os.release().toLowerCase().includes('microsoft')) {
|
|
return true;
|
|
}
|
|
|
|
try {
|
|
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft');
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
if (process.env.__IS_WSL_TEST__) {
|
|
module.exports = isWsl;
|
|
} else {
|
|
module.exports = isWsl();
|
|
}
|