{"version":3,"file":"getMachineId-bsd.cjs","names":["execFileAsync"],"sources":["../../../../../src/detectors/platform/node/machine-id/getMachineId-bsd.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { promises as fs } from 'fs';\nimport { execFileAsync } from './execAsync';\nimport { diag } from '@opentelemetry/api';\n\nconst EXEC_TIMEOUT_MS = 5000;\n\nexport async function getMachineId(): Promise<string | undefined> {\n  try {\n    const result = await fs.readFile('/etc/hostid', { encoding: 'utf8' });\n    return result.trim();\n  } catch (e) {\n    diag.debug(`error reading machine id: ${e}`);\n  }\n\n  try {\n    const result = await execFileAsync(\n      '/bin/kenv',\n      ['-q', 'smbios.system.uuid'],\n      { timeout: EXEC_TIMEOUT_MS }\n    );\n    return result.stdout.trim();\n  } catch (e) {\n    diag.debug(`error reading machine id: ${e}`);\n  }\n\n  return undefined;\n}\n"],"mappings":";;;;AASA,MAAM,kBAAkB;AAExB,eAAsB,eAA4C;CAChE,IAAI;EAEF,QAAO,MADc,GAAA,SAAG,SAAS,eAAe,EAAE,UAAU,OAAO,CAAC,EAAA,CACtD,KAAK;CACrB,SAAS,GAAG;EACV,mBAAA,KAAK,MAAM,6BAA6B,GAAG;CAC7C;CAEA,IAAI;EAMF,QAAO,MALcA,kBAAAA,cACnB,aACA,CAAC,MAAM,oBAAoB,GAC3B,EAAE,SAAS,gBAAgB,CAC7B,EAAA,CACc,OAAO,KAAK;CAC5B,SAAS,GAAG;EACV,mBAAA,KAAK,MAAM,6BAA6B,GAAG;CAC7C;AAGF"}