Skip to content
Snippets Groups Projects
Commit 648c8cb8 authored by lwshang's avatar lwshang Committed by GitHub
Browse files

Print non-output messages to stderr in subkey (#5286)


* Print non-output messages to stderr in subkey

* Update bin/utils/subkey/src/main.rs

Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 082b6643
No related merge requests found
......@@ -81,7 +81,7 @@ trait Crypto: Sized {
{
if let Ok((pair, seed)) = Self::Pair::from_phrase(uri, password) {
let public_key = Self::public_from_pair(&pair);
match output {
OutputType::Json => {
let json = json!({
......@@ -135,7 +135,6 @@ trait Crypto: Sized {
);
},
}
} else if let Ok((public_key, v)) =
<Self::Pair as Pair>::Public::from_string_with_version(uri)
{
......@@ -167,7 +166,7 @@ trait Crypto: Sized {
},
}
} else {
println!("Invalid phrase/URI given");
eprintln!("Invalid phrase/URI given");
}
}
}
......
......@@ -42,7 +42,7 @@ impl RpcClient {
client.insert_key(key_type, suri, public).map(|_| ())
})
.map_err(|e| {
println!("Error inserting key: {:?}", e);
eprintln!("Error inserting key: {:?}", e);
})
);
}
......
......@@ -69,7 +69,7 @@ pub(super) fn generate_key<C: Crypto>(desired: &str) -> Result<KeyPair<C>, &'sta
return Err("Pattern must not be empty");
}
println!("Generating key containing pattern '{}'", desired);
eprintln!("Generating key containing pattern '{}'", desired);
let top = 45 + (desired.len() * 48);
let mut best = 0;
......@@ -94,14 +94,14 @@ pub(super) fn generate_key<C: Crypto>(desired: &str) -> Result<KeyPair<C>, &'sta
score: score,
};
if best >= top {
println!("best: {} == top: {}", best, top);
eprintln!("best: {} == top: {}", best, top);
return Ok(keypair);
}
}
done += 1;
if done % good_waypoint(done) == 0 {
println!("{} keys searched; best is {}/{} complete", done, best, top);
eprintln!("{} keys searched; best is {}/{} complete", done, best, top);
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment