Skip to content

Commit

Permalink
Make rofication block support both the original version and regolith'…
Browse files Browse the repository at this point in the history
…s fork
  • Loading branch information
cfsmp3 committed Jan 6, 2022
1 parent c9169b2 commit ce911c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/blocks/rofication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn rofication_status(socket_path: &str) -> Result<RotificationStatus> {

// Request count
stream
.write(b"num\n")
.write(b"num:\n")
.block_error("rofication", "Failed to write to socket")?;

// Response must be two comma separated integers: regular and critical
Expand All @@ -155,6 +155,8 @@ fn rofication_status(socket_path: &str) -> Result<RotificationStatus> {
.read_to_string(&mut buffer)
.block_error("rofication", "Failed to read from socket")?;

buffer = buffer.replace("\n", ","); // Original rofication uses NL to separate, while regolith forks uses comma. Convert if needed.

let values = buffer.split(',').collect::<Vec<&str>>();
if values.len() != 2 {
return Err(BlockError(
Expand Down

0 comments on commit ce911c1

Please sign in to comment.