mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Give a better error message if writeFile fails due to permission issues
This commit is contained in:
parent
e775d4d84f
commit
9c29a2ed35
1 changed files with 2 additions and 2 deletions
|
@ -23,7 +23,7 @@ sub uniq {
|
||||||
|
|
||||||
sub writeFile {
|
sub writeFile {
|
||||||
my ($fn, $s) = @_;
|
my ($fn, $s) = @_;
|
||||||
open TMP, ">$fn" or die;
|
open TMP, ">$fn" or die "cannot create file `$fn': $!";
|
||||||
print TMP "$s" or die;
|
print TMP "$s" or die;
|
||||||
close TMP or die;
|
close TMP or die;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ sub writeFile {
|
||||||
sub readFile {
|
sub readFile {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
my ($fn) = @_;
|
my ($fn) = @_;
|
||||||
open TMP, "<$fn" or die;
|
open TMP, "<$fn" or die "cannot open file `$fn': $!";
|
||||||
my $s = <TMP>;
|
my $s = <TMP>;
|
||||||
close TMP or die;
|
close TMP or die;
|
||||||
return $s;
|
return $s;
|
||||||
|
|
Loading…
Reference in a new issue