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

W. Trevor King wking at tremily.us
Tue Jul 15 17:17:30 PDT 2014


On Tue, Jul 15, 2014 at 08:49:58PM -0300, David Bremner wrote:
> "W. Trevor King" <wking at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140715/5641a03a/attachment.pgp>


More information about the notmuch mailing list