]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - bin/blhc
Don't split on ; in quotes.
[blhc/blhc.git] / bin / blhc
index 3d5f73c054229f45146713f3a9a871142f79b047..e183027e22886699b7e4c66639ad77c12555034e 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -23,6 +23,7 @@ use warnings;
 
 use Getopt::Long ();
 use Term::ANSIColor ();
+use Text::ParseWords ();
 
 our $VERSION = '0.01';
 
@@ -393,8 +394,10 @@ while (my $line = <>) {
     my $non_verbose = is_non_verbose_build($line);
 
     # One line may contain multiple commands (";"). Treat each one as single
-    # line.
-    my @line = split /(?<!\\);/, $line;
+    # line. parse_line() is slow, only use it when necessary.
+    my @line = (not $line =~ /;/)
+             ? ($line)
+             : Text::ParseWords::parse_line(';', 1, $line);
     foreach $line (@line) {
         # Add newline, drop all other whitespace at the end of a line.
         $line =~ s/\s+$//;