about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-13 13:15:47 +0000
committerEric Wong <e@80x24.org>2023-11-13 21:55:06 +0000
commite9265f8b215ffa24ef4eccd0a7060f3dddc855a9 (patch)
treeb181287779245fb4f2b9a138febb645d158947f3 /t
parentedf8babee1b1cf130f394d0fedf999c858fbc91d (diff)
downloadpublic-inbox-e9265f8b215ffa24ef4eccd0a7060f3dddc855a9.tar.gz
We'll require an error stream for dump_ibx and dump_roots
commands; they're too important to ignore.  Instead of writing
code to provide diagnostics for errors, rely on abort(3) and the
-ggdb3 compiler flag to generate nice core dumps for gdb since
all commands sent to xap_helper are from internal users.
We'll even abort on most usage errors since they could be
bugs in split2argv or our use of getopt(3).

We'll also just exit on ENOMEM errors since it's the easiest way
to recover from those errors by starting a new process which
closes all open Xapian DB handles.
Diffstat (limited to 't')
-rw-r--r--t/xap_helper.t5
1 files changed, 2 insertions, 3 deletions
diff --git a/t/xap_helper.t b/t/xap_helper.t
index 83f59d7d..9e0b234d 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -47,11 +47,10 @@ is(scalar(@int), 1, 'have 1 internal shard') or diag explain(\@int);
 
 my $doreq = sub {
         my ($s, @arg) = @_;
-        my $err = pop @arg if ref($arg[-1]);
+        my $err = ref($arg[-1]) ? pop(@arg) : \*STDERR;
         pipe(my $x, my $y);
         my $buf = join("\0", @arg, '');
-        my @fds = fileno($y);
-        push @fds, fileno($err) if $err;
+        my @fds = (fileno($y), fileno($err));
         my $n = $PublicInbox::IPC::send_cmd->($s, \@fds, $buf, 0) //
                 xbail "send: $!";
         my $exp = length($buf);