convert to path instead of cloning in batch exec
Before adoption: this commit came in with the history the project adopted, so no landing records it.
update changelog
authored by Jonathan Goren · committed by Jonathan Goren · parent 3dc61b5 · Browse files · 3 files·+25 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+25 added−12 removed
- other:+25 added−12 removed
Provenance
- Commit
22dbed0- Tree
4578cb2- Author
Jonathan Goren <jonagn@gmail.com>- Committer
Jonathan Goren <jonagn@gmail.com>- Parent
3dc61b5
3 files changed+25 added−12 removed
modified:src/exec/job.rs+17 added-11 removed
24 unmodified lines25 let lock = rx.lock().unwrap();26 27 // Obtain the next result from the receiver, else if the channel28 // has closed, exit from the loop29- let value: DirEntry = match lock.recv() {30- Ok(WorkerResult::Entry(val)) => val,29+ let dir_entry: DirEntry = match lock.recv() {30+ Ok(WorkerResult::Entry(dir_entry)) => dir_entry,31 Ok(WorkerResult::Error(err)) => {32 if show_filesystem_errors {33 print_error(err.to_string());34 }4 unmodified lines39 40 // Drop the lock so that other threads can read from the receiver.41 drop(lock);42 // Generate a command, execute it and store its exit code.43- results.push(cmd.generate_and_execute(value.path(), Arc::clone(&out_perm), buffer_output))43+ results.push(cmd.generate_and_execute(44+ dir_entry.path(),45+ Arc::clone(&out_perm),46+ buffer_output,47+ ))48 }49 // Returns error in case of any error.50 merge_exitcodes(results)51 }4 unmodified lines56 show_filesystem_errors: bool,57 buffer_output: bool,58 limit: usize,59 ) -> ExitCode {60+ let paths = rx61+ .into_iter()56- let paths = rx.iter().filter_map(|value| match value {57- WorkerResult::Entry(val) => Some(val.path().to_owned()),58- WorkerResult::Error(err) => {59- if show_filesystem_errors {60- print_error(err.to_string());62+ .filter_map(|worker_result| match worker_result {63+ WorkerResult::Entry(dir_entry) => Some(dir_entry.into_path()),64+ WorkerResult::Error(err) => {65+ if show_filesystem_errors {66+ print_error(err.to_string());67+ }68+ None69 }62- None63- }64- });70+ });71 if limit == 0 {72 // no limit73 return cmd.generate_and_execute_batch(paths, buffer_output);74 }10 unmodified linesmodified:src/dir_entry.rs+7 added
35 unmodified lines36 DirEntryInner::BrokenSymlink(pathbuf) => pathbuf.as_path(),37 }38 }39 40+ pub fn into_path(self) -> PathBuf {41+ match self.inner {42+ DirEntryInner::Normal(e) => e.into_path(),43+ DirEntryInner::BrokenSymlink(p) => p,44+ }45+ }46+47 pub fn file_type(&self) -> Option<FileType> {48 match &self.inner {49 DirEntryInner::Normal(e) => e.file_type(),50 DirEntryInner::BrokenSymlink(_) => self.metadata().map(|m| m.file_type()),19 unmodified linesmodified:CHANGELOG.md+1 added-1 removed
6 unmodified lines7 ## Bugfixes8 9 ## Changes10 11+- Directories are now printed with an additional path separator at the end: `foo/bar/`12 ## Other13 14 15 33 unmodified lines49 - Change time comparisons to be exclusive, see #794 (@jacobmischka)50 51 ## Changes52 52-- Directories are now printed with an additional path separator at the end: `foo/bar/`53 - Apply custom `--path-separator` to commands run with `--exec(-batch)` and `--list-details`, see #697 (@aswild)54 55 ## Other56 507 unmodified lines