diff options
Diffstat (limited to 'third_party/nix/src/nix/hash.cc')
-rw-r--r-- | third_party/nix/src/nix/hash.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/third_party/nix/src/nix/hash.cc b/third_party/nix/src/nix/hash.cc index 521f97d53a09..24529c67ce8c 100644 --- a/third_party/nix/src/nix/hash.cc +++ b/third_party/nix/src/nix/hash.cc @@ -74,7 +74,14 @@ struct CmdToBase final : Command { void run() override { for (const auto& s : args) { - std::cout << fmt("%s\n", Hash(s, ht).to_string(base, base == SRI)); + auto hash_ = Hash::deserialize(s, ht); + if (hash_.ok()) { + std::cout << hash_->to_string(base, base == SRI) << "\n"; + } else { + std::cerr << "failed to parse: " << hash_.status().ToString() << "\n"; + // create a matching blank line, for scripting + std::cout << "\n"; + } } } }; |