mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +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
|
||||
}
|
||||
|
||||
fn exec(
|
||||
dir: PathBuf,
|
||||
prefix: &str,
|
||||
rand: usize,
|
||||
suffix: &str,
|
||||
make_dir: bool,
|
||||
quiet: bool,
|
||||
) -> i32 {
|
||||
fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool) -> i32 {
|
||||
let res = if make_dir {
|
||||
let tmpdir = Builder::new()
|
||||
.prefix(prefix)
|
||||
.rand_bytes(rand)
|
||||
.suffix(suffix)
|
||||
.tempdir_in(&dir);
|
||||
|
||||
|
||||
// `into_path` consumes the TempDir without removing it
|
||||
tmpdir.map(|d| d.into_path().to_string_lossy().to_string())
|
||||
} else {
|
||||
|
@ -233,7 +226,7 @@ fn exec(
|
|||
.rand_bytes(rand)
|
||||
.suffix(suffix)
|
||||
.tempfile_in(&dir);
|
||||
|
||||
|
||||
match tmpfile {
|
||||
Ok(f) => {
|
||||
// `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.
|
||||
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 (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1);
|
||||
thread::spawn({
|
||||
|
|
|
@ -25,8 +25,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||
static ABOUT: &str =
|
||||
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.";
|
||||
static LONG_HELP: &str =
|
||||
"If MODE is 'L' the corresponding stream will be line buffered.\n\
|
||||
static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\
|
||||
This option is invalid with standard input.\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\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue