i3-dmenu-desktop: do not die on failed open

This commit is contained in:
Cedric 2016-03-20 12:12:11 +01:00 committed by Cedric Buissart
parent 868180565e
commit 7b1729a85b
1 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,11 @@ binmode STDERR, ':utf8';
# reads in a whole file
sub slurp {
my ($filename) = @_;
open(my $fh, '<', $filename) or die "$!";
my $fh;
if (!open($fh, '<', $filename)) {
warn "Could not open $filename: $!";
return undef;
}
local $/;
my $result;
eval {