forked from lix-project/lix
* Better error messages.
This commit is contained in:
parent
cb7ccb528b
commit
feb3ceaee0
|
@ -17,7 +17,7 @@ my @channels;
|
||||||
# Reads the list of channels from the file $channelsList;
|
# Reads the list of channels from the file $channelsList;
|
||||||
sub readChannels {
|
sub readChannels {
|
||||||
return if (!-f $channelsList);
|
return if (!-f $channelsList);
|
||||||
open CHANNELS, "<$channelsList" or die "cannot open `$channelsList'";
|
open CHANNELS, "<$channelsList" or die "cannot open `$channelsList': $!";
|
||||||
while (<CHANNELS>) {
|
while (<CHANNELS>) {
|
||||||
chomp;
|
chomp;
|
||||||
push @channels, $_;
|
push @channels, $_;
|
||||||
|
@ -28,7 +28,7 @@ sub readChannels {
|
||||||
|
|
||||||
# Writes the list of channels to the file $channelsList;
|
# Writes the list of channels to the file $channelsList;
|
||||||
sub writeChannels {
|
sub writeChannels {
|
||||||
open CHANNELS, ">$channelsList" or die "cannot open `$channelsList'";
|
open CHANNELS, ">$channelsList" or die "cannot open `$channelsList': $!";
|
||||||
foreach my $url (@channels) {
|
foreach my $url (@channels) {
|
||||||
print CHANNELS "$url\n";
|
print CHANNELS "$url\n";
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ sub update {
|
||||||
my $rootFile = "$rootsDir/$userName.gcroot";
|
my $rootFile = "$rootsDir/$userName.gcroot";
|
||||||
my $tmpRootFile = "$rootsDir/$userName-tmp.gcroot";
|
my $tmpRootFile = "$rootsDir/$userName-tmp.gcroot";
|
||||||
|
|
||||||
open ROOT, ">$tmpRootFile" or die "cannot create `$tmpRootFile'";
|
open ROOT, ">$tmpRootFile" or die "cannot create `$tmpRootFile': $!";
|
||||||
print ROOT "$storeExpr";
|
print ROOT "$storeExpr";
|
||||||
close ROOT;
|
close ROOT;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ sub update {
|
||||||
system "@bindir@/nix-env --import '$outPath'";
|
system "@bindir@/nix-env --import '$outPath'";
|
||||||
die "cannot pull set default Nix expression to `$outPath'" if ($? != 0);
|
die "cannot pull set default Nix expression to `$outPath'" if ($? != 0);
|
||||||
|
|
||||||
rename $tmpRootFile, $rootFile or die "cannot rename `$tmpRootFile' to `$rootFile'";
|
rename $tmpRootFile, $rootFile or die "cannot rename `$tmpRootFile' to `$rootFile': $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue