Skip to content

Commit

Permalink
Merge pull request #1 from bandorko/feature/multiplatform
Browse files Browse the repository at this point in the history
supporting windows
  • Loading branch information
bandorko authored Oct 1, 2023
2 parents 76fa904 + f7b2d39 commit 9a41749
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cmd/k6-go/k6-go.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"

"github.com/bandorko/k6-go/internal/builder"
"github.com/bandorko/k6-go/internal/fs"
Expand All @@ -17,7 +18,7 @@ func main() {
log.Fatalln(err)
}
defer os.RemoveAll(tempDir)
customK6File := filepath.Join(tempDir, "custom-k6")
customK6File := filepath.Join(tempDir, getCustomK6FileName())
err = builder.Build(filename, customK6File)
if err != nil {
log.Fatalln(err)
Expand All @@ -26,13 +27,15 @@ func main() {
cmd := exec.Command(customK6File, os.Args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()

/* out, err := exec.RunCommand(context.Background(), 0, tempDir, customK6File, os.Args[1:]...)
log.Println(out)
err = cmd.Run()
if err != nil {
log.Fatalln(err)
if err != nil {
log.Println(out)
log.Fatalln(err)
}*/
}
}

func getCustomK6FileName() string {
if runtime.GOOS == "windows" {
return "custom-k6.exe"
}
return "custom-k6"
}

0 comments on commit 9a41749

Please sign in to comment.