diff --git a/cmd/devbox/control.go b/cmd/devbox/control.go index 23b42dc..9ba265c 100644 --- a/cmd/devbox/control.go +++ b/cmd/devbox/control.go @@ -3,8 +3,8 @@ package main import ( "errors" "fmt" + "os" - "github.com/mattn/go-isatty" "github.com/spf13/cobra" "git.shoemoney.ai/shoemoney/devbox/internal/config" @@ -58,11 +58,13 @@ func daemonHint(err error) error { // isTTY reports whether the command's stdout is an interactive terminal. Used to // decide whether status may show the human-only "(live)" enrichment — piped -// output stays byte-identical to v1 so scripts are unaffected. +// output stays byte-identical to v1 so scripts are unaffected. ponytail: stdlib +// ModeCharDevice over a go-isatty dep; the fleet is mac/Linux, Cygwin is moot. func isTTY(cmd *cobra.Command) bool { - f, ok := cmd.OutOrStdout().(interface{ Fd() uintptr }) + f, ok := cmd.OutOrStdout().(*os.File) if !ok { return false } - return isatty.IsTerminal(f.Fd()) || isatty.IsCygwinTerminal(f.Fd()) + fi, err := f.Stat() + return err == nil && fi.Mode()&os.ModeCharDevice != 0 } diff --git a/go.mod b/go.mod index 6a3ead3..60081a9 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/BurntSushi/toml v1.6.0 github.com/fsnotify/fsnotify v1.10.1 github.com/jotfs/fastcdc-go v0.2.0 - github.com/mattn/go-isatty v0.0.20 github.com/spf13/cobra v1.10.2 github.com/zeebo/blake3 v0.2.4 golang.org/x/time v0.15.0 @@ -18,6 +17,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/cpuid/v2 v2.0.12 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/ncruces/go-strftime v1.0.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/spf13/pflag v1.0.9 // indirect