go program prototype

This commit is contained in:
Benjamin Palko 2024-09-27 08:18:27 -04:00
parent 52c4086104
commit 37f8cae5fd
2 changed files with 39 additions and 0 deletions

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module rust.hearts/main
go 1.23.1

36
main.go Normal file
View file

@ -0,0 +1,36 @@
package main
import (
"fmt"
"os"
"os/exec"
"sync"
)
func main() {
bins := []string{
"Agent_Release_x64",
"AgentManager_Release_x64",
}
cwd, err := os.Getwd()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var wg sync.WaitGroup
for _, bin := range bins {
wg.Add(1)
go func(executable string) {
fmt.Printf("Starting %v...\n", bin)
cmd := exec.Command(cwd + "/deploy/" + executable + ".exe") cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
wg.Done()
}(bin)
}
wg.Wait()
}