-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# "lei inspect" general purpose inspector for stuff in SQLite and
use PublicInbox::Config;
use PublicInbox::MID qw(mids);
use PublicInbox::NetReader qw(imap_uri nntp_uri);
+use POSIX qw(strftime);
+use PublicInbox::LeiOverview;
+*iso8601 = \&PublicInbox::LeiOverview::iso8601;
sub _json_prep ($) {
my ($smsg) = @_;
$smsg->{$_} += 0 for qw(bytes lines); # integerize
+ $smsg->{dt} = iso8601($smsg->{ds}) if defined($smsg->{ds});
+ $smsg->{rt} = iso8601($smsg->{ts}) if defined($smsg->{ts});
+{ %$smsg } # unbless and scalarize
}
$lei->{1}->autoflush(0);
$lei->out('[') if $multi;
while (defined(my $x = shift @$argv)) {
- inspect1($lei, $x, scalar(@$argv)) or return;
+ eval { inspect1($lei, $x, scalar(@$argv)) or return };
+ warn "E: $@\n" if $@;
}
$lei->out(']') if $multi;
}
# TODO: message-ids?, blobs? could get expensive...
}
-sub input_only_atfork_child {
+sub ipc_atfork_child {
my ($self) = @_;
$self->{lei}->_lei_atfork_child;
$self->SUPER::ipc_atfork_child;