mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-18 09:50:34 +01:00
parent
7b8d9322ba
commit
9d26b74c2a
1 changed files with 6 additions and 4 deletions
10
src/walk.rs
10
src/walk.rs
|
@ -6,7 +6,7 @@
|
||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
use exec::{self, TokenizedCommand};
|
use exec;
|
||||||
use fshelper;
|
use fshelper;
|
||||||
use internal::{error, FdOptions};
|
use internal::{error, FdOptions};
|
||||||
use output;
|
use output;
|
||||||
|
@ -83,9 +83,11 @@ pub fn scan(root: &Path, pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
||||||
|
|
||||||
let out_perm = Arc::new(Mutex::new(()));
|
let out_perm = Arc::new(Mutex::new(()));
|
||||||
|
|
||||||
// This is safe because `cmd` will exist beyond the end of this scope.
|
// TODO: the following line is a workaround to replace the `unsafe` block that was
|
||||||
// It's required to tell Rust that it's safe to share across threads.
|
// previously used here to avoid the (unnecessary?) cloning of the command. The
|
||||||
let cmd = unsafe { Arc::from_raw(cmd as *const TokenizedCommand) };
|
// `unsafe` block caused problems on some platforms (SIGILL instructions on Linux) and
|
||||||
|
// therefore had to be removed.
|
||||||
|
let cmd = Arc::new(cmd.clone());
|
||||||
|
|
||||||
// Each spawned job will store it's thread handle in here.
|
// Each spawned job will store it's thread handle in here.
|
||||||
let mut handles = Vec::with_capacity(threads);
|
let mut handles = Vec::with_capacity(threads);
|
||||||
|
|
Loading…
Reference in a new issue