* [PATCH 0/6] process pipe improvements
@ 2021-01-02 9:13 6% Eric Wong
2021-01-02 9:13 7% ` [PATCH 5/6] git: manifest_entry: use ProcessPipe via popen_rd Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-01-02 9:13 UTC (permalink / raw)
To: meta
The DS::in_loop clobbering in MboxReader annoyed me and drove
this series.
I wanted to do it for the bidirectional pipes with
"git cat-file --batch", too, but there seems to be some
lifetime management issues which get hard-to-control
with things like the the waitpid(..,WNOHANG) call
in GitAsyncCat. Maybe switching --batch + DS to use UNIX
sockets can be done to save FDs (or I'm too brain-damaged
to figure this out).
But right now, all of our codebase is robust against children
attempting to reap siblings (or PIDs of former siblings)
Eric Wong (6):
processpipe: allow synchronous close to set $?
processpipe: lazy-require PublicInbox::DS for dwaitpid
git: qx: waitpid synchronously via ProcessPipe->CLOSE
import: switch to using ProcessPipe
git: manifest_entry: use ProcessPipe via popen_rd
qspawn: switch to ProcessPipe via popen_rd
lib/PublicInbox/Git.pm | 20 +++++++++-----
lib/PublicInbox/Import.pm | 23 +++++++---------
lib/PublicInbox/MboxReader.pm | 3 ---
lib/PublicInbox/ProcessPipe.pm | 49 +++++++++++++++++++++-------------
lib/PublicInbox/Qspawn.pm | 15 +++++------
lib/PublicInbox/Spawn.pm | 10 +++----
t/mbox_reader.t | 17 ++++++++++++
t/spawn.t | 38 ++++++++++++++++++++++++++
8 files changed, 119 insertions(+), 56 deletions(-)
^ permalink raw reply [relevance 6%]
* [PATCH 5/6] git: manifest_entry: use ProcessPipe via popen_rd
2021-01-02 9:13 6% [PATCH 0/6] process pipe improvements Eric Wong
@ 2021-01-02 9:13 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-01-02 9:13 UTC (permalink / raw)
To: meta
Only saves us one line of code, but that's better than nothing.
---
lib/PublicInbox/Git.pm | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index cdd2b400..3d97300c 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -507,14 +507,13 @@ sub modified ($) {
# templates/this--description in git.git
sub manifest_entry {
my ($self, $epoch, $default_desc) = @_;
- my ($fh, $pid) = $self->popen('show-ref');
+ my $fh = $self->popen('show-ref');
my $dig = Digest::SHA->new(1);
while (read($fh, my $buf, 65536)) {
$dig->add($buf);
}
- close $fh;
- waitpid($pid, 0);
- return if $?; # empty, uninitialized git repo
+ close $fh or return; # empty, uninitialized git repo
+ undef $fh; # for open, below
my $git_dir = $self->{git_dir};
my $ent = {
fingerprint => $dig->hexdigest,
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-01-02 9:13 6% [PATCH 0/6] process pipe improvements Eric Wong
2021-01-02 9:13 7% ` [PATCH 5/6] git: manifest_entry: use ProcessPipe via popen_rd Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).