diff --git a/cmd/mccl/commands/run_command.go b/cmd/mccl/commands/run_command.go index 0191bec..af9aff8 100755 --- a/cmd/mccl/commands/run_command.go +++ b/cmd/mccl/commands/run_command.go @@ -1,6 +1,7 @@ package commands import ( + "bufio" "errors" "fmt" "mccl/internal/manifest" @@ -139,21 +140,21 @@ func (rc *RunCommand) run_client() error { } cmd := exec.Command(path.Join(javaHome, "bin", "java"), cl...) - // stdout, err := cmd.StdoutPipe() - // cmd.Stderr = cmd.Stdout - // if err != nil { - // return err - // } - // defer stdout.Close() + stdout, err := cmd.StdoutPipe() + cmd.Stderr = cmd.Stdout + if err != nil { + return err + } + defer stdout.Close() - // scanner := bufio.NewScanner(stdout) - // go func() { - // for scanner.Scan() { - // fmt.Println(scanner.Text()) - // } - // }() + scanner := bufio.NewScanner(stdout) + go func() { + for scanner.Scan() { + fmt.Println(scanner.Text()) + } + }() - fmt.Printf("Minecraft version %s is started with usename %s and player's UUID %s.\n", + fmt.Printf("Minecraft version %s is started with username %s and player's UUID %s.\n", manifst.Id, rc.Username, rc.AuthUuid) if err := cmd.Run(); err != nil && (err.Error() != "exec: already started") { return err