From c4a61dfe8af817fcdaf72a75f4fc0e2a07d12cb6 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Thu, 2 Jan 2020 21:45:51 -0500 Subject: [PATCH] mirror-branch: Always exit with 1 on nix-instantiate error Resolving the values and being fancy is harder than the actual benefits would give out. Return all the info we have, and let the pager'd person deal with the data. --- mirror-nixos-branch.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mirror-nixos-branch.pl b/mirror-nixos-branch.pl index ab9d010..9bde023 100755 --- a/mirror-nixos-branch.pl +++ b/mirror-nixos-branch.pl @@ -75,14 +75,11 @@ print STDERR "release is ‘$releaseName’ (build $releaseId), eval is $evalId, # Guard against the channel going back in time. my @curReleaseUrl = split(/\//, read_file("$channelsDir/$channelName", err_mode => 'quiet') // ""); my $curRelease = pop @curReleaseUrl; +$! = 0; # Clear errno to avoid reporting non-fork/exec-related issues my $d = `NIX_PATH= nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \\"$curRelease\\").version (builtins.parseDrvName \\"$releaseName\\").version"`; -if ($? == -1) { - warn("could not execute nix-instantiate ($!).\n"); - exit 127; -} -if ($? > 0) { - warn("error while executing nix-instantiate ($?).\n"); - exit $?; +if ($? != 0) { + warn "Could not execute nix-instantiate: exit $?; errno $!\n"; + exit 1; } chomp $d; if ($d == 1) {