diff options
author | Artturin <Artturin@artturin.com> | 2022-05-14 03:09:20 +0300 |
---|---|---|
committer | Artturin <Artturin@artturin.com> | 2022-05-16 16:16:35 +0300 |
commit | a23fbeb6e8d5c7f35c9feba25da0061ebcf79efe (patch) | |
tree | 49bfd4628d916f27da7ed20d3398bdc67a09d57b /pkgs/build-support | |
parent | b135d3b2234b80c6fb20107121093e18c0a09df7 (diff) |
testers.testVersion: if grep failed then print the output of the command
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/testers/default.nix | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index 3ab97760e725d..020352836c899 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -9,10 +9,19 @@ version ? package.version, }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } '' if output=$(${command} 2>&1); then - grep -Fw "${version}" - <<< "$output" - touch $out + if grep -Fw "${version}" - <<< "$output"; then + touch $out + else + echo "Version string '${version}' not found!" >&2 + echo "The output was:" >&2 + echo "$output" >&2 + exit 1 + fi else - echo "$output" >&2 && exit 1 + echo -n ${lib.escapeShellArg command} >&2 + echo " returned a non-zero exit code." >&2 + echo "$output" >&2 + exit 1 fi ''; |