fix terminal bug

This commit is contained in:
hosted-fornet 2023-10-10 10:16:06 -07:00
parent aa47ba7d55
commit 746379044a
3 changed files with 7 additions and 8 deletions

View File

@ -56,7 +56,8 @@ fn parse_command(our_name: &str, line: String) {
// Is it related to passing json in rather than a Serialize type?
//
print_to_terminal(0, &format!("terminal: {}\r", target_process));
print_to_terminal(0, &format!("terminal: {:?}\r", ProcessId::from_str(target_process).unwrap_or(ProcessId::from_str(&format!("{}:sys:uqbar", target_process)).unwrap())));
print_to_terminal(0, &format!("terminal: {:?}\r", ProcessId::from_str(target_process)));
print_to_terminal(0, &format!("terminal: {:?}\r", ProcessId::from_str(target_process).unwrap_or_else(|_| ProcessId::from_str(&format!("{}:sys:uqbar", target_process)).unwrap())));
send_request(
&Address {
node: if target_node == "our" {
@ -64,7 +65,7 @@ fn parse_command(our_name: &str, line: String) {
} else {
target_node.into()
},
process: ProcessId::from_str(target_process).unwrap_or(
process: ProcessId::from_str(target_process).unwrap_or_else(|_|
ProcessId::from_str(&format!("{}:sys:uqbar", target_process)).unwrap(),
),
},

View File

@ -2009,12 +2009,10 @@ async fn make_event_loop(
}
match senders.get(&kernel_message.target.process) {
Some(ProcessSender::Userspace(sender)) => {
println!("el: sending to {}\r", kernel_message.target.process);
// TODO: should this failing should crash kernel? probably not
sender.send(Ok(kernel_message)).await.unwrap();
}
Some(ProcessSender::Runtime(sender)) => {
println!("el: sending to {}\r", kernel_message.target.process);
sender.send(kernel_message).await.expect("fatal: runtime module died");
}
None => {

View File

@ -110,7 +110,7 @@ fn make_error_message(
rsvp: None,
message: Message::Response((
Response {
ipc: Some(serde_json::to_string(&error).unwrap()), // TODO: handle error?
ipc: Some(serde_json::to_string(&VfsResponse::Err(error)).unwrap()), // TODO: handle error?
metadata: None,
},
None,
@ -261,18 +261,18 @@ pub async fn vfs(
loop {
tokio::select! {
id_done = recv_vfs_task_done.recv() => {
println!("vfs got\r");
println!("vfs got done\r");
let Some(id_done) = id_done else { continue };
response_router.remove(&id_done);
continue;
},
_ = recv_persist_state.recv() => {
println!("vfs got\r");
println!("vfs got persist\r");
persist_state(our_node.clone(), &send_to_loop, &drive_to_vfs).await;
continue;
},
km = recv_from_loop.recv() => {
println!("vfs got\r");
println!("vfs got msg\r");
let Some(km) = km else { continue };
if let Some(response_sender) = response_router.remove(&km.id) {
let _ = response_sender.send(km).await;