dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[QUESTION]: Patch to fix for Windows compile here

Open lonnietc opened this issue 1 year ago • 1 comments

Question.

Hello,

Although I understand that Dgraph is no long supporting Windows, I was able to make a couple of small changes and use "go version go1.19.3 windows/amd64" to enable it to easily compile on my Windows 10 machine.

Here is a small patch for current Repo (6/23/2023) for the "dgraph/x/x.go file to make it work.

--- x-20230623.go       2023-06-23 13:21:54.470012708 -0400
+++ x-20230623-g.go     2023-06-23 13:29:46.838153418 -0400
@@ -38,7 +38,6 @@
        "strings"
        "sync"
        "sync/atomic"
-       "syscall"
        "time"

        "github.com/dustin/go-humanize"
@@ -1116,7 +1115,7 @@
        AssertTrue(pwdType == "Current" || pwdType == "New")
        // ask for the user's password
        fmt.Printf("%s password for %v:", pwdType, userid)
-       pd, err := term.ReadPassword(syscall.Stdin)
+       pd, err := term.ReadPassword(int(os.Stdin.Fd()))
        if err != nil {
                return "", errors.Wrapf(err, "while reading password")
        }
@@ -1125,7 +1124,7 @@

        if times == 2 {
                fmt.Printf("Retype %s password for %v:", strings.ToLower(pwdType), userid)
-               pd2, err := term.ReadPassword(syscall.Stdin)
+               pd2, err := term.ReadPassword(int(os.Stdin.Fd()))
                if err != nil {
                        return "", errors.Wrapf(err, "while reading password")
                }

patch-01.txt

lonnietc avatar Jun 23 '23 17:06 lonnietc

Could you raise a PR? I wouldn't be against merging it if the CI is happy.

mangalaman93 avatar Jul 10 '23 17:07 mangalaman93