From: Nicolas Boisselier Date: Tue, 13 Dec 2022 19:21:58 +0000 (+0100) Subject: Fix bug in &cmd open X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=c6fdbb24b047cd6a124c46197cbaad2eb2bbcfbe;p=nb.git Fix bug in &cmd open --- diff --git a/bin/shell-replace b/bin/shell-replace index f16a5bab..437538be 100755 --- a/bin/shell-replace +++ b/bin/shell-replace @@ -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 { #