Skip to content

Commit

Permalink
cmd/geth: add support for geth attach --testnet (#15597)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorin authored and fjl committed Dec 5, 2017
1 parent afb8154 commit 6e613cf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"os"
"os/signal"
"path/filepath"
"strings"

"github.com/ethereum/go-ethereum/cmd/utils"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6e613cf

Please sign in to comment.