aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorSorin Neacsu <sorin@users.noreply.github.com>2017-12-05 18:17:38 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-05 18:17:38 +0800
commit6e613cf3de6ebfd14edd5a332baf6e4079c1c86f (patch)
treef8bd13e98f1847fe2ce4abaa4fd9ed24c8e161b8 /cmd/geth
parentafb8154eab2961996b321ac3fe5a21602e3b1aff (diff)
downloaddexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar.gz
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar.bz2
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar.lz
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar.xz
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.tar.zst
dexon-6e613cf3de6ebfd14edd5a332baf6e4079c1c86f.zip
cmd/geth: add support for geth attach --testnet (#15597)
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/consolecmd.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go
index 051962be4..2c6b16687 100644
--- a/cmd/geth/consolecmd.go
+++ b/cmd/geth/consolecmd.go
@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"os/signal"
+ "path/filepath"
"strings"
"github.com/ethereum/go-ethereum/cmd/utils"
@@ -114,8 +115,15 @@ func localConsole(ctx *cli.Context) error {
func remoteConsole(ctx *cli.Context) error {
// Attach to a remotely running geth instance and start the JavaScript console
endpoint := ctx.Args().First()
- if endpoint == "" && ctx.GlobalIsSet(utils.DataDirFlag.Name) {
- endpoint = fmt.Sprintf("%s/geth.ipc", ctx.GlobalString(utils.DataDirFlag.Name))
+ if endpoint == "" {
+ path := node.DefaultDataDir()
+ if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
+ path = ctx.GlobalString(utils.DataDirFlag.Name)
+ }
+ if path != "" && ctx.GlobalBool(utils.TestnetFlag.Name) {
+ path = filepath.Join(path, "testnet")
+ }
+ endpoint = fmt.Sprintf("%s/geth.ipc", path)
}
client, err := dialRPC(endpoint)
if err != nil {