Re: [PATCH 3/4] nmbug: Catch stderr in is_unmerged

Subject: Re: [PATCH 3/4] nmbug: Catch stderr in is_unmerged

Date: Tue, 15 Jul 2014 17:17:30 -0700

To: David Bremner

Cc: notmuch@notmuchmail.org

From: W. Trevor King


On Tue, Jul 15, 2014 at 08:49:58PM -0300, David Bremner wrote:
> "W. Trevor King" <wking@tremily.us> writes:
> 
> > +  if ($dir eq '-2|') {
> > +    $dir = '-|';
> > +  }
> > +
> 
> I think I'd prefer an extra flag, rather than making new syntax.
> The existing syntax is not pretty, but it is standard perl

There should be standard Perl syntax for capturing both streams ;).  I
can add a separate parameter instead, but Perl doesn't seem to have
keyword-arguments.  At least, nmbug relies on assumptions about
argument values:

  sub git_pipe {
    my $envref = (ref $_[0] eq 'HASH') ? shift : {};
    my $ioref  = (ref $_[0] eq 'ARRAY') ? shift : undef;
    my $dir = ($_[0] eq '-|' or $_[0] eq '|-') ? shift : undef;
    …
  }

to map positional arguments back into particular semantic meanings.
That seemed ugly enough (can we only have a single boolean argument
with this pattern?) that I'd prefer piggy-backing on Perl's
stream-direction syntax.  But let me know what you like best, and I'll
go that way with v2.  I'd be happy to rewrite nmbug in Python too,
which has (to my eyes) much saner kwargs and subprocess handling.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
signature.asc (application/pgp-signature)

Thread: