Skip to content

Commit

Permalink
chore: ignore empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Jul 15, 2024
1 parent fd7e54b commit 3460202
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions appflowy-plugin/src/core/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::core::rpc_object::RpcObject;
use crate::error::{ReadError, RemoteError};
use serde_json::{json, Value as JsonValue};
use std::io::BufRead;
use tracing::error;
use tracing::{error, warn};

#[derive(Debug, Default)]
pub struct MessageReader(String);
Expand All @@ -21,7 +21,11 @@ impl MessageReader {
self.0.clear();
let _ = reader.read_line(&mut self.0)?;
if self.0.is_empty() {
Err(ReadError::Disconnect("Empty line".to_string()))
// Err(ReadError::Disconnect(
// "stdout doesn't return empty line".to_string(),
// ))
warn!("stdout return unexpected output: {}", self.0);
Ok(RpcObject::from(json!({})))
} else {
self.parse(&self.0)
}
Expand Down
2 changes: 1 addition & 1 deletion appflowy-plugin/src/core/rpc_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<W: Write + Send> RpcLoop<W> {
let json = match read_result {
Ok(json) => json,
Err(err) => {
error!("[RPC] error reading message: {:?}, disconnecting peer", err);
error!("[RPC] read error: {:?}, disconnecting peer", err);
peer.unexpected_disconnect(plugin_id);
return err;
},
Expand Down

0 comments on commit 3460202

Please sign in to comment.