github.com/pojntfx/hydrapp/hydrapp@v0.0.0-20240516002902-d08759d6ca9f/pkg/utils/fork_exec_all.go (about)

     1  //go:build !windows
     2  
     3  package utils
     4  
     5  import (
     6  	"os"
     7  	"syscall"
     8  )
     9  
    10  func ForkExec(path string, args []string) error {
    11  	if _, err := syscall.ForkExec(
    12  		path,
    13  		args,
    14  		&syscall.ProcAttr{
    15  			Env:   os.Environ(),
    16  			Files: []uintptr{os.Stdin.Fd(), os.Stdout.Fd(), os.Stderr.Fd()},
    17  		},
    18  	); err != nil {
    19  		return err
    20  	}
    21  
    22  	return nil
    23  }