diff options
author | Maximilian Meister <mmeister@suse.de> | 2017-11-28 21:00:00 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-11-28 21:00:00 +0800 |
commit | 8f35e3086cbea24839c5435b1cebe85a438b42d3 (patch) | |
tree | bdb74bdc26e497aa93fa8d8bd0e1e11872f329b3 /cmd | |
parent | e323ed5a9a82a2ea603d921492e5109a5ce4e7d2 (diff) | |
download | dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar.gz dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar.bz2 dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar.lz dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar.xz dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.tar.zst dexon-8f35e3086cbea24839c5435b1cebe85a438b42d3.zip |
cmd/geth: fix geth attach --datadir=... (#15517)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/consolecmd.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go index 2bb452d73..051962be4 100644 --- a/cmd/geth/consolecmd.go +++ b/cmd/geth/consolecmd.go @@ -17,6 +17,7 @@ package main import ( + "fmt" "os" "os/signal" "strings" @@ -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) } |