1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Merge pull request #11050 from hercules-ci/issue-10677

Explain when `man` is missing
This commit is contained in:
Robert Hensing 2024-07-05 22:25:38 +02:00 committed by GitHub
commit 0b901e10ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -320,6 +320,10 @@ void showManPage(const std::string & name)
restoreProcessContext(); restoreProcessContext();
setEnv("MANPATH", settings.nixManDir.c_str()); setEnv("MANPATH", settings.nixManDir.c_str());
execlp("man", "man", name.c_str(), nullptr); execlp("man", "man", name.c_str(), nullptr);
if (errno == ENOENT) {
// Not SysError because we don't want to suffix the errno, aka No such file or directory.
throw Error("The '%1%' command was not found, but it is needed for '%2%' and some other '%3%' commands' help text. Perhaps you could install the '%1%' command?", "man", name.c_str(), "nix-*");
}
throw SysError("command 'man %1%' failed", name.c_str()); throw SysError("command 'man %1%' failed", name.c_str());
} }

View file

@ -13,6 +13,9 @@ source common.sh
# Can we ask for the version number? # Can we ask for the version number?
nix-env --version | grep "$version" nix-env --version | grep "$version"
nix_env=$(type -P nix-env)
(PATH=""; ! $nix_env --help 2>&1 ) | grepQuiet -F "The 'man' command was not found, but it is needed for 'nix-env' and some other 'nix-*' commands' help text. Perhaps you could install the 'man' command?"
# Usage errors. # Usage errors.
expect 1 nix-env --foo 2>&1 | grep "no operation" expect 1 nix-env --foo 2>&1 | grep "no operation"
expect 1 nix-env -q --foo 2>&1 | grep "unknown flag" expect 1 nix-env -q --foo 2>&1 | grep "unknown flag"