Merge pull request #5357 from thxCode/support_windows_debug

fix(windows): create debug npipe failure
This commit is contained in:
Phil Estes 2021-04-14 13:37:43 -04:00 committed by GitHub
commit c02081fdc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -190,7 +190,7 @@ can be used and modified as necessary as a custom configuration.`
if config.Debug.Address != "" {
var l net.Listener
if filepath.IsAbs(config.Debug.Address) {
if isLocalAddress(config.Debug.Address) {
if l, err = sys.GetLocalListener(config.Debug.Address, config.Debug.UID, config.Debug.GID); err != nil {
return errors.Wrapf(err, "failed to get listener for debug endpoint")
}

View File

@ -21,6 +21,7 @@ package command
import (
"context"
"os"
"path/filepath"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/services/server"
@ -72,3 +73,7 @@ func handleSignals(ctx context.Context, signals chan os.Signal, serverC chan *se
}()
return done
}
func isLocalAddress(path string) bool {
return filepath.IsAbs(path)
}

View File

@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"strings"
"unsafe"
"github.com/Microsoft/go-winio/pkg/etw"
@ -117,3 +118,7 @@ func init() {
}
}
}
func isLocalAddress(path string) bool {
return strings.HasPrefix(path, `\\.\pipe\`)
}