mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +00:00
maint: format recent changes
This commit is contained in:
parent
263b122540
commit
59a42f1254
3 changed files with 11 additions and 14 deletions
|
@ -210,21 +210,14 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) ->
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec(
|
fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool) -> i32 {
|
||||||
dir: PathBuf,
|
|
||||||
prefix: &str,
|
|
||||||
rand: usize,
|
|
||||||
suffix: &str,
|
|
||||||
make_dir: bool,
|
|
||||||
quiet: bool,
|
|
||||||
) -> i32 {
|
|
||||||
let res = if make_dir {
|
let res = if make_dir {
|
||||||
let tmpdir = Builder::new()
|
let tmpdir = Builder::new()
|
||||||
.prefix(prefix)
|
.prefix(prefix)
|
||||||
.rand_bytes(rand)
|
.rand_bytes(rand)
|
||||||
.suffix(suffix)
|
.suffix(suffix)
|
||||||
.tempdir_in(&dir);
|
.tempdir_in(&dir);
|
||||||
|
|
||||||
// `into_path` consumes the TempDir without removing it
|
// `into_path` consumes the TempDir without removing it
|
||||||
tmpdir.map(|d| d.into_path().to_string_lossy().to_string())
|
tmpdir.map(|d| d.into_path().to_string_lossy().to_string())
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,7 +226,7 @@ fn exec(
|
||||||
.rand_bytes(rand)
|
.rand_bytes(rand)
|
||||||
.suffix(suffix)
|
.suffix(suffix)
|
||||||
.tempfile_in(&dir);
|
.tempfile_in(&dir);
|
||||||
|
|
||||||
match tmpfile {
|
match tmpfile {
|
||||||
Ok(f) => {
|
Ok(f) => {
|
||||||
// `keep` ensures that the file is not deleted
|
// `keep` ensures that the file is not deleted
|
||||||
|
@ -245,7 +238,7 @@ fn exec(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(x) => Err(x)
|
Err(x) => Err(x),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,12 @@ 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, tempfile::Builder::new().prefix("uutils_sort").tempdir_in(&settings.tmp_dir));
|
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({
|
||||||
|
|
|
@ -25,8 +25,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
static ABOUT: &str =
|
static ABOUT: &str =
|
||||||
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
|
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
|
||||||
Mandatory arguments to long options are mandatory for short options too.";
|
Mandatory arguments to long options are mandatory for short options too.";
|
||||||
static LONG_HELP: &str =
|
static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\
|
||||||
"If MODE is 'L' the corresponding stream will be line buffered.\n\
|
|
||||||
This option is invalid with standard input.\n\n\
|
This option is invalid with standard input.\n\n\
|
||||||
If MODE is '0' the corresponding stream will be unbuffered.\n\n\
|
If MODE is '0' the corresponding stream will be unbuffered.\n\n\
|
||||||
Otherwise MODE is a number which may be followed by one of the following:\n\n\
|
Otherwise MODE is a number which may be followed by one of the following:\n\n\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue