]> git.nbdom.net Git - nb.git/commitdiff
Fix bug in &cmd open
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 13 Dec 2022 19:21:58 +0000 (20:21 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 13 Dec 2022 19:21:58 +0000 (20:21 +0100)
bin/shell-replace

index f16a5babb8f2ab9b21e2e5050d5bfc21f4e32fea..437538be1043ea60b9262b445f062d6be7576b40 100755 (executable)
@@ -195,7 +195,8 @@ sub cmd {
        my $hcmd;
 #die $_;
        $cmd =~ s/"/\\"/g;
-       open($hcmd,qq/bash -lc "$cmd" |/) or die $!;
+       # NB 13.12.22 open reurn pid if command failed, so die never called: open($hcmd,qq/bash -lc "$cmd" |/) or die $!;
+       open($hcmd,"$cmd |") or die $!;
        my @cmd = <$hcmd>;
        close $hcmd;
        return wantarray ? @cmd : join('',@cmd);
@@ -246,9 +247,9 @@ sub shell_replace {
                        #
                        $blank = $1;
                        $cmd = $2;
-                       #$line = <$hfile>;
                        push @lines, $line;
                        push @lines, map{ s/^/$blank/; $_ } &cmd($cmd);
+                       $_ = <$hfile>;
 
                } else {
                        #