Print out stdout of a game. Fixed a typo.

This commit is contained in:
Alexander Andreev 2023-11-19 02:10:56 +04:00
parent 11f56b772e
commit 5efbc5a82c
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -1,6 +1,7 @@
package commands package commands
import ( import (
"bufio"
"errors" "errors"
"fmt" "fmt"
"mccl/internal/manifest" "mccl/internal/manifest"
@ -139,21 +140,21 @@ func (rc *RunCommand) run_client() error {
} }
cmd := exec.Command(path.Join(javaHome, "bin", "java"), cl...) cmd := exec.Command(path.Join(javaHome, "bin", "java"), cl...)
// stdout, err := cmd.StdoutPipe() stdout, err := cmd.StdoutPipe()
// cmd.Stderr = cmd.Stdout cmd.Stderr = cmd.Stdout
// if err != nil { if err != nil {
// return err return err
// } }
// defer stdout.Close() defer stdout.Close()
// scanner := bufio.NewScanner(stdout) scanner := bufio.NewScanner(stdout)
// go func() { go func() {
// for scanner.Scan() { for scanner.Scan() {
// fmt.Println(scanner.Text()) 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) manifst.Id, rc.Username, rc.AuthUuid)
if err := cmd.Run(); err != nil && (err.Error() != "exec: already started") { if err := cmd.Run(); err != nil && (err.Error() != "exec: already started") {
return err return err