Skip to content

Commit

Permalink
Merge pull request #490 from hazelops/IZE-658-fix-check-tty-build-for…
Browse files Browse the repository at this point in the history
…-windows

fixed check tty (build for windows)
  • Loading branch information
psihachina authored Oct 10, 2022
2 parents a9460e5 + 6ece4b7 commit bb415b9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions internal/commands/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/AlecAivazis/survey/v2"
"github.com/hazelops/ize/internal/schema"
"github.com/hazelops/ize/internal/version"
"golang.org/x/sys/unix"
"golang.org/x/term"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -103,11 +103,7 @@ func (o *InitOptions) Validate() error {
}

func (o *InitOptions) Run() error {
isTTY := true
_, err := unix.IoctlGetWinsize(int(os.Stdout.Fd()), unix.TIOCGWINSZ)
if err != nil {
isTTY = false
}
isTTY := term.IsTerminal(int(os.Stdout.Fd()))
if len(o.Template) != 0 {
dest, err := generate.GenerateFiles(o.Template, o.Output)
if err != nil {
Expand Down Expand Up @@ -135,7 +131,7 @@ func (o *InitOptions) Run() error {
}
}

dir, err = filepath.Abs(o.Output)
dir, err := filepath.Abs(o.Output)
if err != nil {
return fmt.Errorf("can't init: %w", err)
}
Expand Down

0 comments on commit bb415b9

Please sign in to comment.