Skip to content

Conversation

TerryHowe
Copy link
Member

What this PR does / why we need it:
The https://github.com/containerd/console we are using is pretty much a dead project. There has been a ticket about mac failures for over a year and no action over there other than bug fixes. The project is small time:
Screenshot 2025-09-10 at 6 10 00 PM

The creack/pty project is a lot more active:
Screenshot 2025-09-10 at 6 10 11 PM

Closes: #1449

Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.82%. Comparing base (2188301) to head (5fcc0a3).

Files with missing lines Patch % Lines
...md/oras/internal/display/status/console/console.go 85.71% 0 Missing and 3 partials ⚠️
internal/testutils/console.go 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1850      +/-   ##
==========================================
- Coverage   85.28%   84.82%   -0.46%     
==========================================
  Files         143      143              
  Lines        6742     6769      +27     
==========================================
- Hits         5750     5742       -8     
- Misses        705      731      +26     
- Partials      287      296       +9     

☔ View full report in Codecov by Sentry.
📢 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.

@TerryHowe TerryHowe force-pushed the chore-convert-to-creack-pty branch 2 times, most recently from 9e0f443 to b978cdb Compare September 11, 2025 00:22
@Wwwsylvia Wwwsylvia requested a review from Copilot September 11, 2025 04:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates from the inactive containerd/console library to the more actively maintained creack/pty library for pseudo-terminal functionality, addressing potential Mac compatibility issues.

  • Replaces containerd/console with creack/pty across the codebase
  • Updates console interface and implementation to use the new library
  • Modifies test utilities and test cases to work with the new PTY library

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
go.mod Updates dependency from containerd/console to creack/pty
internal/testutils/console.go Refactors PTY creation and matching utilities to use creack/pty
cmd/oras/internal/display/status/console/console.go Implements new console interface using creack/pty and golang.org/x/term
cmd/oras/internal/display/status/console/console_test.go Updates all test functions to use new PTY interface and terminology
Comments suppressed due to low confidence (2)

go.mod:1

  • Go version 1.25.0 does not exist. The latest stable Go version as of January 2025 was 1.23.x. Please use a valid Go version.
module oras.land/oras

cmd/oras/internal/display/status/console/console.go:1

  • The GetHeightWidth method is missing its implementation. This will cause a compilation error as the method signature exists but has no body.
/*

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Wwwsylvia
Copy link
Member

Should the PR title start with "refactor"?

@shizhMSFT shizhMSFT changed the title chore: convert to creack/pty refactor: convert to creack/pty Sep 11, 2025
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits

Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor suggestions.

@qweeah
Copy link
Contributor

qweeah commented Sep 11, 2025

It would be a good start on extending test coverage in Darwin. Thanks for your contribution. @TerryHowe

Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking approvement back. I tested on Windows and the tty fails. Confirming offline.

Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sry I used a bad build to test on Windows. The actual build in this PR works fine.

@qweeah
Copy link
Contributor

qweeah commented Sep 11, 2025

The width on Window not the actual size though, the width is always 80. @Wwwsylvia @shizhMSFT What do you think?

image

@TerryHowe TerryHowe changed the title refactor: convert to creack/pty chore: convert to console output to creack/pty Sep 11, 2025
@TerryHowe
Copy link
Member Author

Should the PR title start with "refactor"?

Good point, fixed. This happenwd to be a case where the code was nicely encapsulated, so went easier than expected!

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The width on Window not the actual size though, the width is always 80

I've reproduced that. Good catch. It's a regression. We need to find out a way to fix it.

@shizhMSFT
Copy link
Contributor

@TerryHowe After investigating github.com/creack/pty, I found that it does not support Windows. 😢
When calling pty.Getsize(c.file), creack/pty returns ErrUnsupported on Windows. Then oras fallback to a 80x10 window.

@TerryHowe TerryHowe changed the title chore: convert to console output to creack/pty chore: convert console output to creack/pty Sep 11, 2025
@TerryHowe TerryHowe force-pushed the chore-convert-to-creack-pty branch 3 times, most recently from 7d32e57 to 27285ce Compare September 11, 2025 18:05
Signed-off-by: Terry Howe <[email protected]>
@TerryHowe TerryHowe force-pushed the chore-convert-to-creack-pty branch from 27285ce to 5fcc0a3 Compare September 11, 2025 18:22
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
4 participants