mirror of
https://github.com/uutils/coreutils
synced 2025-01-05 17:59:00 +00:00
chore: replace tempdir with tempfile
This commit is contained in:
parent
41539df91d
commit
ebe6341ae3
6 changed files with 7 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2536,7 +2536,7 @@ dependencies = [
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"rayon",
|
"rayon",
|
||||||
"semver 0.9.0",
|
"semver 0.9.0",
|
||||||
"tempdir",
|
"tempfile",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"uucore",
|
"uucore",
|
||||||
"uucore_procs",
|
"uucore_procs",
|
||||||
|
|
|
@ -349,7 +349,6 @@ time = "0.1"
|
||||||
unindent = "0.1"
|
unindent = "0.1"
|
||||||
uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] }
|
uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] }
|
||||||
walkdir = "2.2"
|
walkdir = "2.2"
|
||||||
tempdir = "0.3"
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
rust-users = { version="0.10", package="users" }
|
rust-users = { version="0.10", package="users" }
|
||||||
|
|
|
@ -25,7 +25,7 @@ ouroboros = "0.9.3"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rayon = "1.5"
|
rayon = "1.5"
|
||||||
semver = "0.9.0"
|
semver = "0.9.0"
|
||||||
tempdir = "0.3.7"
|
tempfile = "3"
|
||||||
unicode-width = "0.1.8"
|
unicode-width = "0.1.8"
|
||||||
uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] }
|
uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] }
|
||||||
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
|
@ -23,7 +23,7 @@ use std::{
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use tempdir::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
chunks::{self, Chunk},
|
chunks::{self, Chunk},
|
||||||
|
@ -34,7 +34,7 @@ const MIN_BUFFER_SIZE: usize = 8_000;
|
||||||
|
|
||||||
/// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result.
|
/// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result.
|
||||||
pub fn ext_sort(files: &mut impl Iterator<Item = Box<dyn Read + Send>>, settings: &GlobalSettings) {
|
pub fn ext_sort(files: &mut impl Iterator<Item = Box<dyn Read + Send>>, settings: &GlobalSettings) {
|
||||||
let tmp_dir = crash_if_err!(1, TempDir::new_in(&settings.tmp_dir, "uutils_sort"));
|
let tmp_dir = crash_if_err!(1, tempfile::Builder::new().prefix("uutils_sort").tempdir_in(&settings.tmp_dir));
|
||||||
let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1);
|
let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1);
|
||||||
let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1);
|
let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1);
|
||||||
thread::spawn({
|
thread::spawn({
|
||||||
|
|
|
@ -406,10 +406,9 @@ fn test_domain_socket() {
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::sync::{Arc, Barrier};
|
use std::sync::{Arc, Barrier};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use tempdir::TempDir;
|
|
||||||
use unix_socket::UnixListener;
|
use unix_socket::UnixListener;
|
||||||
|
|
||||||
let dir = TempDir::new("unix_socket").expect("failed to create dir");
|
let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir");
|
||||||
let socket_path = dir.path().join("sock");
|
let socket_path = dir.path().join("sock");
|
||||||
let listener = UnixListener::bind(&socket_path).expect("failed to create socket");
|
let listener = UnixListener::bind(&socket_path).expect("failed to create socket");
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@ use std::path::PathBuf;
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
extern crate tempdir;
|
extern crate tempfile;
|
||||||
#[cfg(not(windows))]
|
|
||||||
use self::tempdir::TempDir;
|
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -1087,7 +1085,7 @@ fn test_ls_indicator_style() {
|
||||||
{
|
{
|
||||||
use self::unix_socket::UnixListener;
|
use self::unix_socket::UnixListener;
|
||||||
|
|
||||||
let dir = TempDir::new("unix_socket").expect("failed to create dir");
|
let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir");
|
||||||
let socket_path = dir.path().join("sock");
|
let socket_path = dir.path().join("sock");
|
||||||
let _listener = UnixListener::bind(&socket_path).expect("failed to create socket");
|
let _listener = UnixListener::bind(&socket_path).expect("failed to create socket");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue