summaryrefslogtreecommitdiffstats
path: root/Cargo.toml
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2017-01-08 10:27:30 -0500
committerAndrew Gallant <jamslam@gmail.com>2017-01-09 16:12:08 -0500
commit461e0c4e33b38532545af4f97ec92bd367963017 (patch)
tree26bbdd3340c1d9b29f90ac7856b18d5d4bb3ebe0 /Cargo.toml
parent82df3b768587e2839db849e6eed2db518a728778 (diff)
Don't search stdout redirected file.
When running ripgrep like this: rg foo > output we must be careful not to search `output` since ripgrep is actively writing to it. Searching it can cause massive blowups where the file grows without bound. While this is conceptually easy to fix (check the inode of the redirection and the inode of the file you're about to search), there are a few problems with it. First, inodes are a Unix thing, so we need a Windows specific solution to this as well. To resolve this concern, I created a new crate, `same-file`, which provides a cross platform abstraction. Second, stat'ing every file is costly. This is not avoidable on Windows, but on Unix, we can get the inode number directly from directory traversal. However, this information wasn't exposed, but now it is (through both the ignore and walkdir crates). Fixes #286
Diffstat (limited to 'Cargo.toml')
-rw-r--r--Cargo.toml1
1 files changed, 1 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ce497a11..d671cbba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,6 +37,7 @@ memchr = "1"
memmap = "0.5"
num_cpus = "1"
regex = "0.2.0"
+same-file = "0.1.1"
termcolor = { version = "0.1.0", path = "termcolor" }
[target.'cfg(windows)'.dependencies]