Re: [PATCH 2/4] dim: shut up sed broken pipe noise in apply-pull
On Wed, May 09, 2018 at 11:10:18AM -0700, Lucas De Marchi wrote: > On Fri, May 4, 2018 at 12:04 AM, Daniel Vetterwrote: > > "head" immediately closes its stdin, which upsets sed. Shut it up. > > > > Cc: Dave Airlie > > Signed-off-by: Daniel Vetter > > --- > > dim | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/dim b/dim > > index b771f9dc5f0d..518043c9058d 100755 > > --- a/dim > > +++ b/dim > > @@ -907,7 +907,7 @@ function dim_apply_pull > > > > cat > $file > > > > - pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file | head -n > > 2 | tail -n 1) > > + pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file 2> > > /dev/null | head -n 2 | tail -n 1) > > If this is doing what I think it is doing (get the second line after > the match, I think it would be much simpler to do without any pipe: > > pull_branch=$(sed -ne '/[gG]it repository at:$/{n;n;p;}' $file) > > i.e, next, next, print :) Yeah that would be much neater. Care to type the patch? The stderr noise was a red herring btw, I can't repro that anymore. -Daniel > > Lucas De Marchi > > > > > if [[ -z "$pull_branch" ]] ; then > > echoerr "no pull request found" > > -- > > 2.17.0 > > > > ___ > > dim-tools mailing list > > dim-tools@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dim-tools -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dim-tools mailing list dim-tools@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dim-tools
Re: [PATCH 2/4] dim: shut up sed broken pipe noise in apply-pull
On Fri, May 4, 2018 at 12:04 AM, Daniel Vetterwrote: > "head" immediately closes its stdin, which upsets sed. Shut it up. > > Cc: Dave Airlie > Signed-off-by: Daniel Vetter > --- > dim | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/dim b/dim > index b771f9dc5f0d..518043c9058d 100755 > --- a/dim > +++ b/dim > @@ -907,7 +907,7 @@ function dim_apply_pull > > cat > $file > > - pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file | head -n 2 > | tail -n 1) > + pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file 2> /dev/null > | head -n 2 | tail -n 1) If this is doing what I think it is doing (get the second line after the match, I think it would be much simpler to do without any pipe: pull_branch=$(sed -ne '/[gG]it repository at:$/{n;n;p;}' $file) i.e, next, next, print :) Lucas De Marchi > > if [[ -z "$pull_branch" ]] ; then > echoerr "no pull request found" > -- > 2.17.0 > > ___ > dim-tools mailing list > dim-tools@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dim-tools ___ dim-tools mailing list dim-tools@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dim-tools
[PATCH 2/4] dim: shut up sed broken pipe noise in apply-pull
"head" immediately closes its stdin, which upsets sed. Shut it up. Cc: Dave AirlieSigned-off-by: Daniel Vetter --- dim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dim b/dim index b771f9dc5f0d..518043c9058d 100755 --- a/dim +++ b/dim @@ -907,7 +907,7 @@ function dim_apply_pull cat > $file - pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file | head -n 2 | tail -n 1) + pull_branch=$(sed -e '0,/[gG]it repository at:$/d' $file 2> /dev/null | head -n 2 | tail -n 1) if [[ -z "$pull_branch" ]] ; then echoerr "no pull request found" -- 2.17.0 ___ dim-tools mailing list dim-tools@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dim-tools