Repository navigation
chore: replace containerd/console with golang.org/x/term - #2062
Merged
TerryHowe merged 1 commit intoJul 11, 2026
Merged
Conversation
TerryHowe
requested review from
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
May 27, 2026 14:32
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2062 +/- ##
==========================================
+ Coverage 87.27% 87.35% +0.07%
==========================================
Files 138 138
Lines 5486 5488 +2
==========================================
+ Hits 4788 4794 +6
+ Misses 417 414 -3
+ Partials 281 280 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TerryHowe
force-pushed
the
feat/replace-containerd-console
branch
from
June 10, 2026 14:07
84354fa to
22e57e1
Compare
Member
Author
|
@renshao if you get a chance, maybe you could functionally test this on Windows |
Contributor
Yes, I can. I will report back my test result. |
Contributor
renshao
approved these changes
Jun 15, 2026
Member
Author
|
Thanks for testing @renshao |
TerryHowe
force-pushed
the
feat/replace-containerd-console
branch
from
July 10, 2026 10:09
22e57e1 to
958a74b
Compare
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 <[email protected]>
TerryHowe
force-pushed
the
feat/replace-containerd-console
branch
from
July 10, 2026 10:16
958a74b to
13f3daf
Compare
shizhMSFT
approved these changes
Jul 11, 2026
shizhMSFT
left a comment
Contributor
There was a problem hiding this comment.
LGTM. The change looks clean.
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
github.com/containerd/console(notably a long-standing macOS bug) withgolang.org/x/term, maintained by the Go team and working on linux, mac and windows.consolepackage now renders to an internalterminalseam backed byx/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.containerd.NewPty); they useos.Pipeviatestutils.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 onterm.IsTerminal(os.Stderr)before any TTY handler is constructed). The previous containerd-basedNewConsolealso rejected non-terminal files as defense-in-depth; that check is now redundant, soNewConsolerejects only anilfile. The three*_invalidTTYhandler tests were updated to passnilaccordingly. 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)