Skip to content

Commit cff57b7

Browse files
authored
Remove nix dependency (#1237)
1 parent b151e6d commit cff57b7

5 files changed

Lines changed: 10 additions & 39 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ ouroboros = "0.18.3"
3232
serde = { version = "1.0.116", features = ["derive"] }
3333
time = { version = "0.3.47", default-features = false, features = ["parsing", "macros", "std"] }
3434

35-
[target.'cfg(unix)'.dependencies]
36-
nix = { version = "0.31.2", default-features = false, features = [
37-
"fs",
38-
"user",
39-
] }
40-
4135
[target.'cfg(windows)'.dependencies]
4236
which = "8.0.2"
4337

src/import.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(crate) struct ImportError {
4848
/// format. Doesn't abort on per-record errors — bad rows are skipped, the
4949
/// rest of the import continues. After the iteration completes successfully,
5050
/// the database is deduplicated and aged.
51-
pub(crate) fn run<I: Importer>(importer: &I, db: &mut Database) -> Result<()> {
51+
pub(crate) fn run(importer: &impl Importer, db: &mut Database) -> Result<()> {
5252
let stderr = io::stderr();
5353
let mut stderr = stderr.lock();
5454

@@ -60,7 +60,7 @@ pub(crate) fn run<I: Importer>(importer: &I, db: &mut Database) -> Result<()> {
6060
Some(path) => format!("{}:{}", path.display(), e.line_num),
6161
None => format!("line {}", e.line_num),
6262
};
63-
let _ = writeln!(stderr, "{location}: {:#}", e.source);
63+
_ = writeln!(stderr, "{location}: {:#}", e.source);
6464
}
6565
}
6666
}

src/import/atuin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Iterator for Iter {
110110

111111
impl Drop for Iter {
112112
fn drop(&mut self) {
113-
let _ = self.child.kill();
114-
let _ = self.child.wait();
113+
_ = self.child.kill();
114+
_ = self.child.wait();
115115
}
116116
}

src/util.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,9 @@ pub fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> {
168168
// Set the owner of the tmpfile (UNIX only).
169169
#[cfg(unix)]
170170
if let Ok(metadata) = path.metadata() {
171-
use std::os::unix::fs::MetadataExt;
171+
use std::os::unix::fs::{MetadataExt, fchown};
172172

173-
use nix::unistd::{self, Gid, Uid};
174-
175-
let uid = Uid::from_raw(metadata.uid());
176-
let gid = Gid::from_raw(metadata.gid());
177-
_ = unistd::fchown(&tmp_file, Some(uid), Some(gid));
173+
_ = fchown(&tmp_file, Some(metadata.uid()), Some(metadata.gid()));
178174
}
179175

180176
// Close and rename the tmpfile.

0 commit comments

Comments
 (0)