Fixes: bug #34240: --pipe does not respect -r

This commit is contained in:
Ole Tange 2011-09-08 10:53:26 +02:00
parent b53dda2525
commit 795c0fa3bd
5 changed files with 16 additions and 2 deletions

View file

@ -242,7 +242,7 @@ parallel convert -resize {3} -quality {2} {1} {1.}_{3}_q{2}.jpg :::: - ::: 25 50
# Thank you for watching
#
# If you like GNU Parallel:
# * Post this video on forums/blogs/Google+/Twitter/Facebook/Linkedin
# * Post this video on forums/blogs/Identi.ca/Google+/Twitter/Facebook/Linkedin
# * Join the mailing list http://lists.gnu.org/mailman/listinfo/parallel
# * Request or write a review for your favourite blog or magazine
# * Request or build a package for your favourite distribution

View file

@ -90,7 +90,7 @@ https://build.opensuse.org/package/show?package=parallel&project=home%3Atange
YYYYMMDD=`yyyymmdd`
pushd /tmp
rm parallel-$YYYYMMDD.tar.bz2
rm -rf parallel-${YYYYMMDD}*
wget http://ftp.gnu.org/gnu/parallel/parallel-$YYYYMMDD.tar.bz2
#wget http://alpha.gnu.org/gnu/parallel/parallel-$YYYYMMDD.tar.bz2
tar xjvf parallel-$YYYYMMDD.tar.bz2

View file

@ -186,6 +186,13 @@ sub spreadstdin {
while(read(STDIN,substr($buf,length $buf,0),$::opt_blocksize)) {
# substr above = append to $buf
reap_if_needed(); # Re-enable reaping after read() (Bug#33352)
if($::opt_r) {
# Remove empty lines
$buf=~s/^\s*\n//gm;
if(length $buf == 0) {
next;
}
}
if($::opt_regexp) {
if($Global::max_number_of_args) {
# -N => (start..*?end){n}

View file

@ -24,4 +24,8 @@ parallel -j1 -kX echo {}-{.} ::: a ::: b
parallel -j2 -kX echo {}-{.} ::: a b ::: c d
parallel -j2 -kX echo {}-{.} ::: a b c ::: d e f
parallel -j0 -kX echo {}-{.} ::: a b c ::: d e f
echo '### Test of -r with --pipe - the first should give an empty line. The second should not.'
echo | parallel -j2 -N1 --pipe cat | wc -l
echo | parallel -r -j2 -N1 --pipe cat | wc -l
EOF

View file

@ -41,3 +41,6 @@ b-b f-f
c-c d-d
c-c e-e
c-c f-f
### Test of -r with --pipe - the first should give an empty line. The second should not.
1
0