Skip to content

Commit 69228e1

Browse files
authored
fix(daemon): replace expect with context in spawn_inner (#1568)
## SUMMARY Fixes daemon crashes by replacing `.expect()` with proper error handling in `spawn_inner()`. Errors now return cleanly instead of panicking. --- ## FIX ```rust // before .expect("Failed to create log file") // after .context("failed to create log file")? ``` --- ## VERIFICATION * Break log path / fill disk → no crash * Disable stdout/stderr → no crash **Result:** daemon stays up, errors are logged properly.
2 parents a78775b + fa411f8 commit 69228e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

binaries/daemon/src/spawn/prepared.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ impl PreparedNode {
296296
&self.node.id,
297297
))
298298
.await
299-
.expect("Failed to create log file");
299+
.context("failed to create log file")?;
300300
let mut child_stdout =
301-
tokio::io::BufReader::new(child.stdout().take().expect("failed to take stdout"));
301+
tokio::io::BufReader::new(child.stdout().take().context("failed to take stdout")?);
302302
let stdout_tx = tx.clone();
303303
let node_id = self.node.id.clone();
304304
let mut logger_c = logger.try_clone().await?;
@@ -352,7 +352,7 @@ impl PreparedNode {
352352
});
353353

354354
let mut child_stderr =
355-
tokio::io::BufReader::new(child.stderr().take().expect("failed to take stderr"));
355+
tokio::io::BufReader::new(child.stderr().take().context("failed to take stderr")?);
356356

357357
// Stderr listener stream
358358
let stderr_tx = tx.clone();

0 commit comments

Comments
 (0)