die if write to output file fails for any reason.

This commit is contained in:
Bradley M. Kuhn 2011-12-06 09:27:31 -05:00
parent c13600b7fb
commit df4e0f2f0e

View file

@ -1,7 +1,7 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
# hierarchy-comparison -*- Perl -*- # hierarchy-comparison -*- Perl -*-
# Possible bug: only -type f and -type d are checked # Possible bug: only -type f and -type d are checked
# Copyright (C) 2001, 2002, 2003, 2004, 2008 Bradley M. Kuhn <bkuhn@ebb.org> # Copyright (C) 2001, 2002, 2003, 2004, 2008, 2011 Bradley M. Kuhn <bkuhn@ebb.org>
# Copyright (C) 2011 Denver Gingerich <denver@ossguy.com> # Copyright (C) 2011 Denver Gingerich <denver@ossguy.com>
# #
# This software's license gives you freedom; you can copy, convey, # This software's license gives you freedom; you can copy, convey,
@ -63,6 +63,8 @@ sub FindAndSortOutput {
print FILE_OUTPUT "$file\n"; print FILE_OUTPUT "$file\n";
} }
close FILE_OUTPUT; close FILE_OUTPUT;
die "unable to write to output file: $output: $! ($?)"
if $? != 0 and defined $output;
return @sortedChompedFiles; return @sortedChompedFiles;
} }