aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2025-07-04 13:00:30 +0200
committerTomasz Kramkowski <tomasz@kramkow.ski>2025-07-04 13:00:30 +0200
commitd016176a3c5bd80f28315032e1176ab91e4fae85 (patch)
tree3e2d33b128d486b560669a362c2aabd618ffaa67
parent37cec514b40b7f1243f98de4e5bb17de04754b0a (diff)
downloadmqttr-d016176a3c5bd80f28315032e1176ab91e4fae85.tar.gz
mqttr-d016176a3c5bd80f28315032e1176ab91e4fae85.tar.xz
mqttr-d016176a3c5bd80f28315032e1176ab91e4fae85.zip
Use write_all instead of write for the message
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/main.rs2
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d65e12..9c7523f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,8 @@
### Fixed
* Changelog 0.1.0 link now references the tag not an arbitrary diff.
+* The entire MQTT message should now be attempted to be written (previously it
+ may have been cut off in some situations).
## [0.1.0]
diff --git a/src/main.rs b/src/main.rs
index 84ee406..edbfa1d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -26,7 +26,7 @@ async fn run(program: &[String], message: &Publish) -> anyhow::Result<()> {
}
let mut proc = command.stdin(Stdio::piped()).spawn()?;
let mut stdin = proc.stdin.take().context("No stdin")?;
- stdin.write(&message.payload).await?;
+ stdin.write_all(&message.payload).await?;
drop(stdin);
println!("{}", proc.wait().await?);
Ok(())