Skip to content

Commit 0b97695

Browse files
committed
fix:nerdctl ps show nothing when timeout
Signed-off-by: ningmingxiao <[email protected]>
1 parent d13fb45 commit 0b97695

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

cmd/nerdctl/compose/compose_ps.go

-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"fmt"
2222
"strings"
2323
"text/tabwriter"
24-
"time"
2524

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

346345
// statusForFilter returns the status value to be matched with the 'status' filter
347346
func statusForFilter(ctx context.Context, c containerd.Container) string {
348-
// Just in case, there is something wrong in server.
349-
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
350-
defer cancel()
351-
352347
task, err := c.Task(ctx, nil)
353348
if err != nil {
354349
// NOTE: NotFound doesn't mean that container hasn't started.

pkg/containerutil/containerutil.go

-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ func PrintHostPort(ctx context.Context, writer io.Writer, container containerd.C
8686

8787
// ContainerStatus returns the container's status from its task.
8888
func ContainerStatus(ctx context.Context, c containerd.Container) (containerd.Status, error) {
89-
// Just in case, there is something wrong in server.
90-
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
91-
defer cancel()
92-
9389
task, err := c.Task(ctx, nil)
9490
if err != nil {
9591
return containerd.Status{}, err

pkg/formatter/formatter.go

-4
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ import (
3939
)
4040

4141
func ContainerStatus(ctx context.Context, c containerd.Container) string {
42-
// Just in case, there is something wrong in server.
43-
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
44-
defer cancel()
4542
titleCaser := cases.Title(language.English)
46-
4743
task, err := c.Task(ctx, nil)
4844
if err != nil {
4945
// NOTE: NotFound doesn't mean that container hasn't started.

0 commit comments

Comments
 (0)