//go:build windows
// +build windows

package global

import (
	"os/exec"
)

func ExecCmd(command string) ([]byte, error) {
	cmd := exec.Command("cmd", "/C", command)
	out, err := cmd.CombinedOutput()
	if err != nil {
		return nil, err
	}

	return out, nil
}

func ExecOsCmd(command, os string) ([]byte, error) {
	var cmd *exec.Cmd
	switch os {
	case "Linux":
		cmd = exec.Command(command)
	case "Windows":
		cmd = exec.Command("cmd", "/C", command)
	}

	out, err := cmd.CombinedOutput()
	if err != nil {
		return nil, err
	}
	return out, nil
}
