source: trip-planner-front/node_modules/is-wsl/index.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 558 bytes
Line 
1'use strict';
2const os = require('os');
3const fs = require('fs');
4const isDocker = require('is-docker');
5
6const isWsl = () => {
7 if (process.platform !== 'linux') {
8 return false;
9 }
10
11 if (os.release().toLowerCase().includes('microsoft')) {
12 if (isDocker()) {
13 return false;
14 }
15
16 return true;
17 }
18
19 try {
20 return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ?
21 !isDocker() : false;
22 } catch (_) {
23 return false;
24 }
25};
26
27if (process.env.__IS_WSL_TEST__) {
28 module.exports = isWsl;
29} else {
30 module.exports = isWsl();
31}
Note: See TracBrowser for help on using the repository browser.