Skip to content

Commit 2de38a9

Browse files
committed
fix(windows): create debug npipe failure
Signed-off-by: Weijia Mai <[email protected]>
1 parent f968359 commit 2de38a9

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

cmd/containerd/command/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ can be used and modified as necessary as a custom configuration.`
190190

191191
if config.Debug.Address != "" {
192192
var l net.Listener
193-
if filepath.IsAbs(config.Debug.Address) {
193+
if isLocalAddress(config.Debug.Address) {
194194
if l, err = sys.GetLocalListener(config.Debug.Address, config.Debug.UID, config.Debug.GID); err != nil {
195195
return errors.Wrapf(err, "failed to get listener for debug endpoint")
196196
}

cmd/containerd/command/main_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package command
2121
import (
2222
"context"
2323
"os"
24+
"path/filepath"
2425

2526
"github.com/containerd/containerd/log"
2627
"github.com/containerd/containerd/services/server"
@@ -72,3 +73,7 @@ func handleSignals(ctx context.Context, signals chan os.Signal, serverC chan *se
7273
}()
7374
return done
7475
}
76+
77+
func isLocalAddress(path string) bool {
78+
return filepath.IsAbs(path)
79+
}

cmd/containerd/command/main_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"os"
23+
"strings"
2324
"unsafe"
2425

2526
"github.com/Microsoft/go-winio/pkg/etw"
@@ -117,3 +118,7 @@ func init() {
117118
}
118119
}
119120
}
121+
122+
func isLocalAddress(path string) bool {
123+
return strings.HasPrefix(path, `\\.\pipe\`)
124+
}

0 commit comments

Comments
 (0)