File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import * as os from 'os';
8
8
import { CliError } from './cli/cli-error' ;
9
9
import { TELEMETRY_TRACKING_TOKEN } from './constants' ;
10
10
import isDocker from './utils/is-docker' ;
11
+ import { isWsl } from './utils/is-wsl' ;
11
12
import { getMachineId } from './utils/machine-id-utils' ;
12
13
import { getVersion } from './utils/version-utils' ;
13
14
@@ -42,6 +43,7 @@ export class Telemetry {
42
43
private readonly version = getVersion ( ) ;
43
44
private readonly prismaVersion = getPrismaVersion ( ) ;
44
45
private readonly isDocker = isDocker ( ) ;
46
+ private readonly isWsl = isWsl ( ) ;
45
47
private exitWait = 200 ;
46
48
47
49
constructor ( ) {
@@ -105,6 +107,7 @@ export class Telemetry {
105
107
version : this . version ,
106
108
prismaVersion : this . prismaVersion ,
107
109
isDocker : this . isDocker ,
110
+ isWsl : this . isWsl ,
108
111
...properties ,
109
112
} ;
110
113
this . mixpanel . track ( event , payload ) ;
Original file line number Diff line number Diff line change
1
+ import process from 'node:process' ;
2
+ import os from 'node:os' ;
3
+ import fs from 'node:fs' ;
4
+ export const isWsl = ( ) => {
5
+ if ( process . platform !== 'linux' ) {
6
+ return false ;
7
+ }
8
+
9
+ if ( os . release ( ) . toLowerCase ( ) . includes ( 'microsoft' ) ) {
10
+ return true ;
11
+ }
12
+
13
+ try {
14
+ return fs . readFileSync ( '/proc/version' , 'utf8' ) . toLowerCase ( ) . includes ( 'microsoft' ) ;
15
+ } catch {
16
+ return false ;
17
+ }
18
+ } ;
You can’t perform that action at this time.
0 commit comments