Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions packages/node/src/attributes/MachineIdentitfierAttributeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,35 @@ export class MachineIdentitfierAttributeProvider implements BacktraceAttributePr
}

public generateGuid() {
switch (process.platform) {
case 'win32': {
return execSync(this.COMMANDS['win32'])
.toString()
.match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i)?.[0]
.toLowerCase();
}
case 'darwin': {
return execSync(this.COMMANDS[process.platform])
.toString()
.split('IOPlatformUUID')[1]
.split('\n')[0]
.replace(/=|\s+|"/gi, '')
.toLowerCase();
}
case 'linux':
case 'freebsd': {
return execSync(this.COMMANDS[process.platform])
.toString()
.replace(/\r+|\n+|\s+/gi, '')
.toLowerCase();
}
default: {
return null;
try {
switch (process.platform) {
case 'win32': {
return execSync(this.COMMANDS['win32'])
.toString()
.match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i)?.[0]
.toLowerCase();
}
case 'darwin': {
return execSync(this.COMMANDS[process.platform])
.toString()
.split('IOPlatformUUID')[1]
.split('\n')[0]
.replace(/=|\s+|"/gi, '')
.toLowerCase();
}
case 'linux':
case 'freebsd': {
return execSync(this.COMMANDS[process.platform])
.toString()
.replace(/\r+|\n+|\s+/gi, '')
.toLowerCase();
}
default: {
return null;
}
}
} catch {
return null
}
}
}
Loading