github.com/UlisseMini/utils@v0.0.0-20181216031219-f016c7ea9463/bg/bg.go (about)

     1  // +build !windows
     2  
     3  package bg
     4  
     5  import (
     6  	"io"
     7  	"os/exec"
     8  )
     9  
    10  // Spawn is a wrapper for executing commands
    11  // in the background.
    12  func Spawn(cmd *exec.Cmd, c io.ReadWriter) error {
    13  	cmd.Stdout = c
    14  	cmd.Stderr = c
    15  	cmd.Stdin = c
    16  
    17  	return cmd.Run()
    18  }