mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-26 01:31:57 -07:00
ripgrep: use exit code 2 to indicate error
Exit code 1 was shared to indicate both "no results" and "error." Use status code 2 to indicate errors, similar to grep's behavior. Fixes #948 PR #954
This commit is contained in:
committed by
Andrew Gallant
parent
223d7d9846
commit
ca23a170f7
@@ -2191,3 +2191,33 @@ fn type_list() {
|
||||
// This can change over time, so just make sure we print something.
|
||||
assert!(!lines.is_empty());
|
||||
}
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/948
|
||||
sherlock!(
|
||||
exit_code_match_success,
|
||||
".",
|
||||
".",
|
||||
|wd: WorkDir, mut cmd: Command| {
|
||||
wd.assert_exit_code(0, &mut cmd);
|
||||
}
|
||||
);
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/948
|
||||
sherlock!(
|
||||
exit_code_no_match,
|
||||
"6d28e48b5224a42b167e{10}",
|
||||
".",
|
||||
|wd: WorkDir, mut cmd: Command| {
|
||||
wd.assert_exit_code(1, &mut cmd);
|
||||
}
|
||||
);
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/948
|
||||
sherlock!(
|
||||
exit_code_error,
|
||||
"*",
|
||||
".",
|
||||
|wd: WorkDir, mut cmd: Command| {
|
||||
wd.assert_exit_code(2, &mut cmd);
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user