Merge pull request #1254 from bas-vk/ipcwindowspathfix

Invalid named pipe name
This commit is contained in:
Jeffrey Wilcke 2015-06-12 04:39:38 -07:00
commit aaac1f0cdd
4 changed files with 26 additions and 5 deletions

View File

@ -52,7 +52,6 @@ func init() {
app.Action = run
app.Flags = []cli.Flag{
utils.IPCDisabledFlag,
utils.IPCPathFlag,
utils.VerbosityFlag,
utils.JSpathFlag,
@ -93,7 +92,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)

View File

@ -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,
)

View File

@ -385,9 +385,28 @@ 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)

View File

@ -95,6 +95,9 @@ func DefaultDataDir() string {
}
func DefaultIpcPath() string {
if runtime.GOOS == "windows" {
return `\\.\pipe\geth.ipc`
}
return filepath.Join(DefaultDataDir(), "geth.ipc")
}