about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-05-01 06:21:17 +0000
committerEric Wong <e@80x24.org>2021-05-01 23:12:41 +0000
commit6dbc443f8acfb262ca1ab263b60ecb801c00aac2 (patch)
tree385920c43311bae5ba2d4085a1c37a037e353084 /script
parent0d00fb2ee87d714ede9f8937dde9bae8d778804d (diff)
downloadpublic-inbox-6dbc443f8acfb262ca1ab263b60ecb801c00aac2.tar.gz
The contents of the old lei.q.output will not be removed,
but will be converted into the new one.
Diffstat (limited to 'script')
-rwxr-xr-xscript/lei7
1 files changed, 7 insertions, 0 deletions
diff --git a/script/lei b/script/lei
index 90a93839..bec6b001 100755
--- a/script/lei
+++ b/script/lei
@@ -33,8 +33,15 @@ my $exec_cmd = sub {
                 push @rdr, shift(@old), $newfh;
         }
         my $do_exec = sub {
+                my @non_std; # ex. $op_p from lei_edit_search
                 while (my ($io, $newfh) = splice(@rdr, 0, 2)) {
+                        my $old_io = !!$io;
                         open $io, '+<&', $newfh or die "open +<&=: $!";
+                        push @non_std, $io unless $old_io;
+                }
+                if (@non_std) {
+                        require Fcntl;
+                        fcntl($_, Fcntl::F_SETFD(), 0) for @non_std;
                 }
                 my %env = map { split(/=/, $_, 2) } splice(@argv, $argc);
                 @ENV{keys %env} = values %env;