-
Notifications
You must be signed in to change notification settings - Fork 20.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/geth: fix passing datadir flag to attach subcommand #15517
Conversation
cmd/geth/consolecmd.go
Outdated
@@ -48,13 +48,17 @@ See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console.`, | |||
Name: "attach", | |||
Usage: "Start an interactive JavaScript environment (connect to node)", | |||
ArgsUsage: "[endpoint]", | |||
Flags: append(consoleFlags, utils.DataDirFlag), | |||
Flags: append(consoleFlags), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could remove the append here.
f8a0714
to
af75892
Compare
Perhaps we should fix the subcommand to accept |
af75892
to
7f998c1
Compare
@karalabe is this the right way to fix it? i just assumed that the ipc endpoint will always be called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0
@@ -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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
конечная точка : = ctx. Args (). Первый ()
- если ctx. GlobalIsSet (utils. DataDirFlag . Name ) {
- endpoint = fmt. Sprintf ( " % s /geth.ipc " , ctx. GlobalString (utils. DataDirFlag . Name ))
+} - клиент , err : = dialRPC (конечная точка)
cmd/geth/consolecmd.go
Outdated
@@ -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 ctx.GlobalIsSet(utils.DataDirFlag.Name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but please use --datadir
only if the first argument is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fjl done, thanks
7f998c1
to
348dc79
Compare
cmd/geth/consolecmd.go
Outdated
@@ -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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unnecessary parens here. You can write endpoint == "" && ctx.GlobalIsSet(utils.DataDirFlag.Name)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fjl sure, fixed
the datadir flag wasn't respected, instead you had to provide an additional argument, which was unclear from a usage point of view Signed-off-by: Maximilian Meister <[email protected]>
348dc79
to
afab235
Compare
the datadir flag wasn't respected, instead you had to provide an
additional argument, which was unclear from a usage point of view
Signed-off-by: Maximilian Meister [email protected]
I tried the following on a private network: