Skip to content

Conversation

@fanquake
Copy link
Member

Refactors bitcoin-wallet so that it doesn't return a non-zero exit code by default, and makes the option handling more inline with the other binaries. i.e outputting Error: too few parameters if you don't pass any options.

Fixing this means we can check the process output in gen-manpages.py; which addresses the remaining review comment from #24263.

Adjust the exit codes / functionality of bitcoin-wallet such that it's
not returning a non-zero exit code if there isn't a problem.

This is a followup from bitcoin#24263, and should allow us to add and
additional check=True to our gen-manpages.py script.
Now that bitcoin-wallet no-longer returns a non-zero exit code when it
shouldn't do, we can add check=True to our subprocess call.

Follows up to the comments in
bitcoin#24263 (comment).
}

static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
static int WalletAppInit(ArgsManager& args, int argc, char* argv[])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe make this option<int>, a categorical difference seems slightly neater to me than reserving a return code for continuing execution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially since EXIT_SUCCESS and EXIT_FAILURE are not guaranteed to be non--1 :)

@laanwj
Copy link
Member

laanwj commented Feb 23, 2022

Concept ACK

1 similar comment
@theStack
Copy link
Contributor

Concept ACK

Comment on lines +116 to +118
if (ret != CONTINUE_EXECUTION) {
return ret;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it'd be better to just have WalletAppInit call exit(2) directly?

@gruve-p
Copy link
Contributor

gruve-p commented Apr 4, 2022

Concept ACK

@maflcko
Copy link
Member

maflcko commented Sep 12, 2022

Alternative in #26067 using std::optional<int>

@fanquake fanquake deleted the improve_bitcoin_wallet_return branch November 9, 2022 16:33
@bitcoin bitcoin locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants