Permalink
Browse files

Detect and report limitation where .gz and .bz2 filenames can't conta…

…in single quotes
  • Loading branch information...
1 parent 5ec8737 commit a2ccf618c5355a4ead023b2801cb6a3215778620 @hoytech committed Oct 16, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 bin/log-defer-viz
View
5 bin/log-defer-viz
@@ -148,11 +148,14 @@ unshift(@ARGV, '-') unless @ARGV;
while (my $file = shift) {
my $fh;
- ## FIXME: do this with a perl module in case zcat/bzcat aren't available
+ ## FIXME: Do these with perl modules in case zcat/bzcat aren't available.
+ ## This would also fix stupid single quote limitation below.
if ($file =~ /[.]gz$/) {
+ die qq{filename "$file" can't contain single quotes } if $file =~ /'/;
open($fh, "zcat '$file' |") || die "couldn't open $file with zcat: $!";
} elsif ($file =~ /[.]bz2$/) {
+ die qq{filename "$file" can't contain single quotes } if $file =~ /'/;
open($fh, "bzcat '$file' |") || die "couldn't open $file with bzcat: $!";
} elsif ($file eq '-') {
$fh = \*STDIN;

0 comments on commit a2ccf61

Please sign in to comment.