m hint added

This commit is contained in:
Drew Tada 2024-02-22 12:20:48 -05:00
parent a002acff61
commit ee5e5f009e
2 changed files with 18 additions and 5 deletions

View File

@ -80,14 +80,22 @@ fn init(_our: Address) {
println!("m: awaiting response for {}s", s);
match req.send_and_await_response(*s).unwrap() {
Ok(res) => {
let _ = Response::new().body(res.body()).send();
// TODO piping is broken. Patching it by just printing the response
// let _ = Response::new().body(res.body()).send();
if let Ok(txt) = std::str::from_utf8(&res.body()) {
println!("{txt}");
} else {
println!("{:?}", res.body());
}
}
Err(e) => {
println!(
"m: failed to send message {}",
"m: {}",
match e.kind {
SendErrorKind::Timeout => "due to timeout",
SendErrorKind::Offline => "because the target is offline",
SendErrorKind::Timeout =>
"target did not send Response in time, try increasing the await time",
SendErrorKind::Offline =>
"failed to send message because the target is offline",
}
);
}

View File

@ -981,12 +981,17 @@ pub async fn kernel(
.send(t::Printout {
verbosity: 0,
content: format!(
"event loop: got {} from network for {}, but process does not exist (perhaps it terminated)",
"event loop: got {} from network for {}, but process does not exist{}",
match kernel_message.message {
t::Message::Request(_) => "Request",
t::Message::Response(_) => "Response",
},
kernel_message.target.process,
match kernel_message.message {
t::Message::Request(_) => "",
t::Message::Response(_) =>
"\nhint: if you are using `m`, try awaiting the Response: `m --await 5 ...`",
}
)
})
.await;