1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00
Files
opentelemetry-go/sdk/resource/host_id_exec.go
T

22 lines
470 B
Go
Raw Normal View History

// Copyright The OpenTelemetry Authors
2024-02-29 07:05:28 +01:00
// SPDX-License-Identifier: Apache-2.0
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris
package resource // import "go.opentelemetry.io/otel/sdk/resource"
import (
"context"
"os/exec"
)
func execCommand(name string, arg ...string) (string, error) {
cmd := exec.CommandContext(context.Background(), name, arg...)
b, err := cmd.Output()
if err != nil {
return "", err
}
return string(b), nil
}