Skip to content

Commit

Permalink
cmd/geth: fix geth attach --datadir=... (#15517)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianMeister authored and fjl committed Nov 28, 2017
1 parent e323ed5 commit 8f35e30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package main

import (
"fmt"
"os"
"os/signal"
"strings"
Expand Down Expand Up @@ -112,7 +113,11 @@ func localConsole(ctx *cli.Context) error {
// console to it.
func remoteConsole(ctx *cli.Context) error {
// Attach to a remotely running geth instance and start the JavaScript console
client, err := dialRPC(ctx.Args().First())
endpoint := ctx.Args().First()
if endpoint == "" && ctx.GlobalIsSet(utils.DataDirFlag.Name) {
endpoint = fmt.Sprintf("%s/geth.ipc", ctx.GlobalString(utils.DataDirFlag.Name))
}
client, err := dialRPC(endpoint)
if err != nil {
utils.Fatalf("Unable to attach to remote geth: %v", err)
}
Expand Down

0 comments on commit 8f35e30

Please sign in to comment.