Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nerdctl ps show nothing when timeout #4010

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/nerdctl/compose/compose_ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"strings"
"text/tabwriter"
"time"

"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -345,10 +344,6 @@ func formatPublishers(labelMap map[string]string) []PortPublisher {

// statusForFilter returns the status value to be matched with the 'status' filter
func statusForFilter(ctx context.Context, c containerd.Container) string {
// Just in case, there is something wrong in server.
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()

task, err := c.Task(ctx, nil)
if err != nil {
// NOTE: NotFound doesn't mean that container hasn't started.
Expand Down
4 changes: 0 additions & 4 deletions pkg/containerutil/containerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ func PrintHostPort(ctx context.Context, writer io.Writer, container containerd.C

// ContainerStatus returns the container's status from its task.
func ContainerStatus(ctx context.Context, c containerd.Container) (containerd.Status, error) {
// Just in case, there is something wrong in server.
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()

task, err := c.Task(ctx, nil)
if err != nil {
return containerd.Status{}, err
Expand Down
4 changes: 0 additions & 4 deletions pkg/formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ import (
)

func ContainerStatus(ctx context.Context, c containerd.Container) string {
// Just in case, there is something wrong in server.
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
titleCaser := cases.Title(language.English)

task, err := c.Task(ctx, nil)
if err != nil {
// NOTE: NotFound doesn't mean that container hasn't started.
Expand Down
Loading