Skip to content

Commit

Permalink
Merge pull request #6032 from conr2d/create_wallet
Browse files Browse the repository at this point in the history
Don't create a wallet when failed to create password file
  • Loading branch information
heifner authored Oct 17, 2018
2 parents a78a8b2 + 0a95422 commit 05d848e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2548,10 +2548,8 @@ int main( int argc, char** argv ) {
createWallet->add_option("-f,--file", password_file, localized("Name of file to write wallet password output to. (Must be set, unless \"--to-console\" is passed"));
createWallet->add_flag( "--to-console", print_console, localized("Print password to console."));
createWallet->set_callback([&wallet_name, &password_file, &print_console] {
if (password_file.empty() && !print_console) {
std::cerr << "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" << std::endl;
return;
}
EOSC_ASSERT( !password_file.empty() ^ print_console, "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" );
EOSC_ASSERT( password_file.empty() || !std::ofstream(password_file.c_str()).fail(), "ERROR: Failed to create file in specified path" );

const auto& v = call(wallet_url, wallet_create, wallet_name);
std::cout << localized("Creating wallet: ${wallet_name}", ("wallet_name", wallet_name)) << std::endl;
Expand Down

0 comments on commit 05d848e

Please sign in to comment.