Skip to content

chore: replace containerd/console with golang.org/x/term#2062

Open
TerryHowe wants to merge 1 commit into
oras-project:mainfrom
TerryHowe:feat/replace-containerd-console
Open

chore: replace containerd/console with golang.org/x/term#2062
TerryHowe wants to merge 1 commit into
oras-project:mainfrom
TerryHowe:feat/replace-containerd-console

Conversation

@TerryHowe

Copy link
Copy Markdown
Member

Summary

  • Replaces the effectively-unmaintained github.com/containerd/console (notably a long-standing macOS bug) with golang.org/x/term, maintained by the Go team and working on linux, mac and windows.
  • The console package now renders to an internal terminal seam backed by x/term, keeping the terminal library isolated behind an interface so the backend can be swapped or extended later without touching callers. Cursor/escape-code logic is unchanged.
  • Test helpers no longer create a real pty (containerd.NewPty); they use os.Pipe via testutils.NewPipe/MatchPipe, so the previously linux-only TTY tests now run on all platforms (no creack/pty, no ConPTY, no x/sys).

Note for reviewers

Terminal detection already lives in option.Terminal.Parse (gating on term.IsTerminal(os.Stderr) before any TTY handler is constructed). The previous containerd-based NewConsole also rejected non-terminal files as defense-in-depth; that check is now redundant, so NewConsole rejects only a nil file. The three *_invalidTTY handler tests were updated to pass nil accordingly. Happy to thread an injectable console through the handler chain instead if you'd prefer to keep the non-terminal rejection.

Closes: #1449

Test plan

  • go build ./...
  • go vet ./...
  • go test ./... for affected packages, now passing on macOS (previously skipped)

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.30%. Comparing base (a065810) to head (22e57e1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2062      +/-   ##
==========================================
+ Coverage   87.26%   87.30%   +0.04%     
==========================================
  Files         138      138              
  Lines        5465     5467       +2     
==========================================
+ Hits         4769     4773       +4     
+ Misses        415      414       -1     
+ Partials      281      280       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The github.com/containerd/console project is effectively unmaintained
(notably a long-standing macOS bug). Replace it with golang.org/x/term,
which is maintained by the Go team and works on linux, mac and windows.

The console package now renders to an internal terminal seam backed by
x/term, keeping the terminal library isolated behind an interface so the
backend can be swapped or extended without touching callers. Cursor and
escape-code logic is unchanged.

Test helpers no longer create a real pty (containerd.NewPty): they use
os.Pipe via testutils.NewPipe/MatchPipe, so the previously linux-only
tests now run on all platforms. Terminal detection remains centralized
in option.Terminal, so NewConsole only rejects a nil file.

Closes: oras-project#1449
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@TerryHowe TerryHowe force-pushed the feat/replace-containerd-console branch from 84354fa to 22e57e1 Compare June 10, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

containerd/console is broken for mac consider creack/pty

1 participant