File tree Expand file tree Collapse file tree 1 file changed +28
-24
lines changed
packages/node/src/attributes Expand file tree Collapse file tree 1 file changed +28
-24
lines changed Original file line number Diff line number Diff line change @@ -24,31 +24,35 @@ export class MachineIdentitfierAttributeProvider implements BacktraceAttributePr
2424 }
2525
2626 public generateGuid ( ) {
27- switch ( process . platform ) {
28- case 'win32' : {
29- return execSync ( this . COMMANDS [ 'win32' ] )
30- . toString ( )
31- . match ( / [ a - f 0 - 9 ] { 8 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 12 } / i) ?. [ 0 ]
32- . toLowerCase ( ) ;
33- }
34- case 'darwin' : {
35- return execSync ( this . COMMANDS [ process . platform ] )
36- . toString ( )
37- . split ( 'IOPlatformUUID' ) [ 1 ]
38- . split ( '\n' ) [ 0 ]
39- . replace ( / = | \s + | " / gi, '' )
40- . toLowerCase ( ) ;
41- }
42- case 'linux' :
43- case 'freebsd' : {
44- return execSync ( this . COMMANDS [ process . platform ] )
45- . toString ( )
46- . replace ( / \r + | \n + | \s + / gi, '' )
47- . toLowerCase ( ) ;
48- }
49- default : {
50- return null ;
27+ try {
28+ switch ( process . platform ) {
29+ case 'win32' : {
30+ return execSync ( this . COMMANDS [ 'win32' ] )
31+ . toString ( )
32+ . match ( / [ a - f 0 - 9 ] { 8 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 4 } - [ a - f 0 - 9 ] { 12 } / i) ?. [ 0 ]
33+ . toLowerCase ( ) ;
34+ }
35+ case 'darwin' : {
36+ return execSync ( this . COMMANDS [ process . platform ] )
37+ . toString ( )
38+ . split ( 'IOPlatformUUID' ) [ 1 ]
39+ . split ( '\n' ) [ 0 ]
40+ . replace ( / = | \s + | " / gi, '' )
41+ . toLowerCase ( ) ;
42+ }
43+ case 'linux' :
44+ case 'freebsd' : {
45+ return execSync ( this . COMMANDS [ process . platform ] )
46+ . toString ( )
47+ . replace ( / \r + | \n + | \s + / gi, '' )
48+ . toLowerCase ( ) ;
49+ }
50+ default : {
51+ return null ;
52+ }
5153 }
54+ } catch {
55+ return null
5256 }
5357 }
5458}
You can’t perform that action at this time.
0 commit comments