Skip to content

Commit

Permalink
Merge pull request #504 from rycee/daemon-graceful-shutdown
Browse files Browse the repository at this point in the history
fix: make graceful daemon shutdown exit with code 0
  • Loading branch information
Nukesor authored Mar 5, 2024
2 parents 6fd3f7c + a355e72 commit 81e52f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Fix reading of configuration files that lacks a `shared` section.

- Made the daemon exit gracefully (exit code 0) on SIGINT and SIGTEM.

## [3.3.3] - 2024-01-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pueue/src/daemon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn setup_signal_panic_handling(settings: &Settings, sender: &TaskSender) -> Resu
ctrlc::set_handler(move || {
// Notify the task handler
sender_clone
.send(Shutdown::Emergency)
.send(Shutdown::Graceful)
.expect("Failed to send Message to TaskHandler on Shutdown");
})?;

Expand Down
2 changes: 1 addition & 1 deletion pueue/tests/daemon/integration/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async fn test_ctrlc() -> Result<()> {
let result = child.try_wait();
assert!(matches!(result, Ok(Some(_))));
let code = result.unwrap().unwrap();
assert!(matches!(code.code(), Some(1)));
assert!(matches!(code.code(), Some(0)));

Ok(())
}
Expand Down

1 comment on commit 81e52f0

@AlizeIm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy

Please sign in to comment.