diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-12 15:32:37 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-06-12 15:32:37 +0800 |
commit | 359e6414e50df415caa1d4411224c6d48b6cb798 (patch) | |
tree | 2bbe96226f778e0b5d06dd32408bf6646fcf829a | |
parent | 22080e1fdd8eafd6201bb5a06ac19859bcc6b432 (diff) | |
download | go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar.gz go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar.bz2 go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar.lz go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar.xz go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.tar.zst go-tangerine-359e6414e50df415caa1d4411224c6d48b6cb798.zip |
fixed windows ipc path issue
-rw-r--r-- | cmd/console/main.go | 2 | ||||
-rw-r--r-- | cmd/geth/main.go | 4 | ||||
-rw-r--r-- | cmd/utils/flags.go | 22 | ||||
-rw-r--r-- | common/path.go | 3 |
4 files changed, 27 insertions, 4 deletions
diff --git a/cmd/console/main.go b/cmd/console/main.go index 9020a12fe..365dbec56 100644 --- a/cmd/console/main.go +++ b/cmd/console/main.go @@ -93,7 +93,7 @@ func main() { func run(ctx *cli.Context) { jspath := ctx.GlobalString(utils.JSpathFlag.Name) - ipcpath := ctx.GlobalString(utils.IPCPathFlag.Name) + ipcpath := utils.IpcSocketPath(ctx) repl := newJSRE(jspath, ipcpath) repl.welcome(ipcpath) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 11ea23165..0f2438cfd 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -308,7 +308,7 @@ func console(ctx *cli.Context) { ethereum, ctx.String(utils.JSpathFlag.Name), ctx.GlobalString(utils.RPCCORSDomainFlag.Name), - filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "geth.ipc"), + utils.IpcSocketPath(ctx), true, nil, ) @@ -330,7 +330,7 @@ func execJSFiles(ctx *cli.Context) { ethereum, ctx.String(utils.JSpathFlag.Name), ctx.GlobalString(utils.RPCCORSDomainFlag.Name), - ctx.GlobalString(utils.IPCPathFlag.Name), + utils.IpcSocketPath(ctx), false, nil, ) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 80f21d50a..3626c36f2 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -385,9 +385,29 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager { return accounts.NewManager(ks) } +func IpcSocketPath(ctx *cli.Context) (ipcpath string) { + + if common.IsWindows() { + ipcpath = common.DefaultIpcPath() + if ipcpath != ctx.GlobalString(IPCPathFlag.Name) { + ipcpath = ctx.GlobalString(IPCPathFlag.Name) + } + } else { + ipcpath = common.DefaultIpcPath() + if ctx.GlobalString(IPCPathFlag.Name) != common.DefaultIpcPath() { + ipcpath = ctx.GlobalString(IPCPathFlag.Name) + } else if ctx.GlobalString(DataDirFlag.Name) != "" && + ctx.GlobalString(DataDirFlag.Name) != common.DefaultDataDir() { + ipcpath = filepath.Join(ctx.GlobalString(DataDirFlag.Name), "geth.ipc") + } + } + + return +} + func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { config := comms.IpcConfig{ - Endpoint: filepath.Join(ctx.GlobalString(DataDirFlag.Name), "geth.ipc"), + Endpoint: IpcSocketPath(ctx), } xeth := xeth.New(eth, nil) diff --git a/common/path.go b/common/path.go index 63a23abcd..6e3259656 100644 --- a/common/path.go +++ b/common/path.go @@ -95,6 +95,9 @@ func DefaultDataDir() string { } func DefaultIpcPath() string { + if runtime.GOOS == "windows" { + return `\\.\pipe\geth.ipc` + } return filepath.Join(DefaultDataDir(), "geth.ipc") } |