Skip to content

Commit

Permalink
fix(backend): strip extra null characters from output
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenclaw900 committed Dec 12, 2021
1 parent 921cf4f commit fd7711c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend/src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub async fn term_handler(socket: warp::ws::WebSocket) {

let pty_reader = tokio::spawn(async move {
loop {
let mut data = [0; 512];
let mut data = [0; 256];
let lock = cmd_read.read().await;
match (*lock).pty().read(&mut data) {
Ok(_) => {}
Expand All @@ -76,7 +76,10 @@ pub async fn term_handler(socket: warp::ws::WebSocket) {
if stop_thread_read.load(Relaxed) {
break;
}
socket_send.send(Message::binary(data)).await.unwrap();
socket_send
.send(Message::binary(data.split(|num| num == &0).next().unwrap()))
.await
.unwrap();
}
stop_thread_read.store(true, Relaxed);
// Writer won't exit until page is changed/closed
Expand Down
Binary file modified src/frontend/.yarn/install-state.gz
Binary file not shown.

0 comments on commit fd7711c

Please sign in to comment.