grep-cli: support files compressed by compress(1)

While Linux distributions (at least Arch Linux, RHEL, Debian) do not support
compressing files with compress(1), macOS & AIX do (the utility is part of
POSIX). Additionally, gzip is able to uncompress such compressed files and
provides an `uncompress` binary.

Closes #1547
This commit is contained in:
Wieland Hoffmann
2020-04-10 11:19:25 +02:00
committed by Andrew Gallant
parent 28f2a93cae
commit df7a3bfc7f
5 changed files with 23 additions and 0 deletions

View File

@@ -970,6 +970,21 @@ be, to a very large extent, the result of luck. Sherlock Holmes
eqnice!(expected, cmd.stdout());
});
rgtest!(compressed_uncompress, |dir: Dir, mut cmd: TestCommand| {
if !cmd_exists("uncompress") {
return;
}
dir.create_bytes("sherlock.Z", include_bytes!("./data/sherlock.Z"));
cmd.arg("-z").arg("Sherlock").arg("sherlock.Z");
let expected = "\
For the Doctor Watsons of this world, as opposed to the Sherlock
be, to a very large extent, the result of luck. Sherlock Holmes
";
eqnice!(expected, cmd.stdout());
});
rgtest!(compressed_failing_gzip, |dir: Dir, mut cmd: TestCommand| {
if !cmd_exists("gzip") {
return;