mirror of
https://github.com/mickael-menu/zk
synced 2024-11-19 03:25:40 +00:00
20 lines
414 B
Go
20 lines
414 B
Go
package exec
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"strings"
|
|
"syscall"
|
|
)
|
|
|
|
// CommandFromString returns a Cmd running the given command.
|
|
func CommandFromString(command string, args ...string) *exec.Cmd {
|
|
cmd := exec.Command("cmd")
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
|
HideWindow: false,
|
|
CmdLine: fmt.Sprintf(` /v:on/s/c "%s %s"`, command, strings.Join(args[:], " ")),
|
|
CreationFlags: 0,
|
|
}
|
|
return cmd
|
|
}
|