Skip to content

Commit

Permalink
Unlock daemon lock file before exiting
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <[email protected]>
  • Loading branch information
t1m0thyj committed Dec 24, 2024
1 parent 8487a88 commit ea6da7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion zowex/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions zowex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ whoami = "1.5.0"
yansi = "0.5.1"

[target.'cfg(windows)'.dependencies]
defer = "0.2.1"
fslock = "0.2.1"
windows-sys = "0.52.0"

Expand Down
4 changes: 4 additions & 0 deletions zowex/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use std::time::Duration;
use base64::prelude::*;
use is_terminal::IsTerminal;

#[cfg(target_family = "windows")]
extern crate defer;
#[cfg(target_family = "windows")]
extern crate fslock;
#[cfg(target_family = "windows")]
Expand Down Expand Up @@ -314,6 +316,8 @@ pub async fn run_daemon_command(

#[cfg(target_family = "windows")]
let mut lock_file = get_win_lock_file()?;
#[cfg(target_family = "windows")]
defer::defer! { lock_file.unlock() };

#[cfg(target_family = "windows")]
let mut locked = false;
Expand Down

0 comments on commit ea6da7e

Please sign in to comment.