Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
macos fix
  • Loading branch information
nate smith committed Aug 27, 2020
commit 44eaf8525cbe9b0a94361ff15073f411dd143ee3
12 changes: 8 additions & 4 deletions pkg/cmd/repo/garden/garden.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"io"
"math/rand"
"net/http"
"os"
"os/exec"
"runtime"
"strconv"
Expand Down Expand Up @@ -189,12 +188,17 @@ func gardenRun(opts *GardenOptions) error {
drawGarden(out, garden, player)

// thanks stackoverflow https://stackoverflow.com/a/17278776
_ = exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
_ = exec.Command("stty", "-F", "/dev/tty", "-echo").Run()
if runtime.GOOS == "darwin" {
_ = exec.Command("stty", "-f", "/dev/tty", "cbreak", "min", "1").Run()
_ = exec.Command("stty", "-f", "/dev/tty", "-echo").Run()
} else {
_ = exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
_ = exec.Command("stty", "-F", "/dev/tty", "-echo").Run()
}

var b []byte = make([]byte, 1)
for {
_, err := os.Stdin.Read(b)
_, err := opts.IO.In.Read(b)
if err != nil {
return err
}
Expand Down