Skip to content

Commit

Permalink
Update nix
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>
  • Loading branch information
Elizafox committed Feb 20, 2024
1 parent b8f4796 commit 8fe50df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
15 changes: 2 additions & 13 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ envy = "0.4.2"
heck = { version = "0.4.1", features = ["unicode"] }
itertools = "0.12.1"
lazy_static = "1.4.0"
nix = { version = "0.26.4", default-features = false, features = ["dir", "process", "user"] }
nix = { version = "0.27.1", default-features = false, features = ["dir", "process", "user"] }
num_cpus = "1.16.0"
once_cell = { version = "1.19.0", features = ["parking_lot"] }
proctitle = "0.1.1"
Expand Down
2 changes: 1 addition & 1 deletion src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub(crate) fn open_pid_file(env: &EnvVars) -> Result<File> {
.map_err(|e| Error::new(e).context("PID file is locked (process already running?)"))?;

// Erase and write new PID
ftruncate(pid_file.as_raw_fd(), 0)?;
ftruncate(&pid_file, 0)?;
pid_file
.write_all(getpid().to_string().as_bytes())
.map_err(|e| Error::new(e).context("Failed to write to PID file"))?;
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/

use std::{fs::File, net::SocketAddr, os::fd::AsRawFd};
use std::{fs::File, net::SocketAddr};

use anyhow::Result;
use axum::Server;
Expand Down Expand Up @@ -100,7 +100,7 @@ async fn shutdown_signal(pid_file: &mut File) {
error!("signal received, starting graceful shutdown");

// Clear PID file
let _ = ftruncate(pid_file.as_raw_fd(), 0);
let _ = ftruncate(pid_file, 0);
}

// We must fork before we do anything else.
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn tokio_main(env: &EnvVars, pid_file: &mut File) -> Result<()> {
server.await?;

// FIXME - do we actually get here?
let _ = ftruncate(pid_file.as_raw_fd(), 0);
let _ = ftruncate(pid_file, 0);

Ok(())
}

0 comments on commit 8fe50df

Please sign in to comment.