Skip to content

Commit c939434

Browse files
committed
Handle terminal exit output
1 parent c8fceff commit c939434

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

anycode-backend/src/handlers/terminal_handler.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ pub async fn handle_terminal_start(
130130
}
131131
}
132132
}
133+
let exit_message = "\r\nterminal process exited\r\n".to_string();
134+
{
135+
let mut buffer_guard = buffer_clone.lock().await;
136+
buffer_guard.push_back(exit_message.clone());
137+
}
138+
139+
let data_channel = format!("terminal:data:{}", tname);
140+
let sockets_guard = sockets_clone.lock().await;
141+
for socket in sockets_guard.iter() {
142+
let _ = socket.emit(&data_channel, &exit_message);
143+
}
133144
info!("Terminal output handler finished for {}", tname);
134145
});
135146

0 commit comments

Comments
 (0)