Fix IPC Paths For Windows (#11324)

* return early for windows

* mick's review
This commit is contained in:
Nishant Das
2022-08-27 07:05:28 +08:00
committed by GitHub
parent c94095b609
commit 3cbb4aace4
3 changed files with 11 additions and 2 deletions

View File

@@ -113,7 +113,7 @@ func (s *Service) newRPCClientWithAuth(ctx context.Context, endpoint network.End
if err != nil {
return nil, err
}
case "":
case "", "ipc":
client, err = gethRPC.DialIPC(ctx, endpoint.Url)
if err != nil {
return nil, err

View File

@@ -188,6 +188,9 @@ func main() {
if err := cmd.ExpandSingleEndpointIfFile(ctx, flags.ExecutionEngineEndpoint); err != nil {
return err
}
if err := cmd.ExpandSingleEndpointIfFile(ctx, flags.HTTPWeb3ProviderFlag); err != nil {
return err
}
if ctx.IsSet(flags.SetGCPercent.Name) {
runtimeDebug.SetGCPercent(ctx.Int(flags.SetGCPercent.Name))
}

View File

@@ -4,6 +4,7 @@ import (
"bufio"
"fmt"
"os"
"runtime"
"strings"
"github.com/pkg/errors"
@@ -73,12 +74,17 @@ func EnterPassword(confirmPassword bool, pr PasswordReader) (string, error) {
return passphrase, nil
}
// ExpandSingleEndpointIfFile expands the path for --http-web3provider if specified as a file.
// ExpandSingleEndpointIfFile expands the path for --execution-provider if specified as a file.
func ExpandSingleEndpointIfFile(ctx *cli.Context, flag *cli.StringFlag) error {
// Return early if no flag value is set.
if !ctx.IsSet(flag.Name) {
return nil
}
// Return early for non-unix operating systems, as there is
// no shell path expansion for ipc endpoints on windows.
if runtime.GOOS == "windows" {
return nil
}
web3endpoint := ctx.String(flag.Name)
switch {
case strings.HasPrefix(web3endpoint, "http://"):