feat: omc原始代码

This commit is contained in:
TsMask committed 2024-03-12 10:58:33 +08:00
1 parent 5133c93971
commit 2d01bb86d1
432 files changed
+66597 -1

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
//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
}