mirror of
https://github.com/cachix/install-nix-action.git
synced 2024-11-22 08:30:51 +00:00
26 lines
426 B
JavaScript
26 lines
426 B
JavaScript
|
'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();
|
||
|
}
|