From 4734d674b045eae661997735ebea671cbb2ece7e Mon Sep 17 00:00:00 2001 From: shoemoney Date: Tue, 23 Jun 2026 10:47:46 -0500 Subject: [PATCH] =?UTF-8?q?refactor(M8):=20drop=20go-isatty=20dep=20for=20?= =?UTF-8?q?stdlib=20ModeCharDevice=20(ponytail)=20=E2=99=BB=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isTTY only gates a cosmetic status enrichment; os.Stdout.Stat() & ModeCharDevice is the stdlib one-liner. Cygwin detection is moot on a mac/Linux fleet. go-isatty demoted back to an indirect dep. --- cmd/devbox/control.go | 10 ++++++---- go.mod | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) 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