package main import ( "fmt" "os" "os/exec" ) func main() { cmd := exec.Command("echo", "Hello, World!") files := []*os.File{os.Stdin, os.Stdout, os.Stderr} // inherit file descriptors cmd.Stdout = os.Stdout // set stdout to a specific file cmd.Dir = "/tmp" // set working directory cmd.SysProcAttr = &syscall.SysProcAttr{ // set system process attributes Setpgid: true, // set process group ID } cmd.SysProcAttr.Files = make([]*os.File, len(files)) copy(cmd.SysProcAttr.Files, files) err := cmd.Run() if err != nil { fmt.Println(err) } }In this example, we are using a ProcAttr struct to define attributes for a command that we are spawning with the exec package. We are inheriting the standard input, output, and error file descriptors from the parent process, and specifying a new file descriptor to use for stdout. We are also setting the working directory and system process attributes for the child process. This package library is part of the standard Go library and does not require any additional installation.