github.com/UlisseMini/utils@v0.0.0-20181216031219-f016c7ea9463/bg/bg_windows.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.SysProcAttr.HideWindow = true
    14  
    15  	cmd.Stdout = c
    16  	cmd.Stderr = c
    17  	cmd.Stdin = c
    18  
    19  	return cmd.Run()
    20  }