Permalink
Browse files

Fix logic of input/output options in pipelines

Patch by Taylan Ulrich B.

The man page states "If any input or output options are given then the
program behaves only in the requested mode.", but this doesn't seem to
be true.

The following will put out "bar", then change the primary selection to "foo".

echo foo | { echo bar | xsel -pi; xsel -po; }

The above example doesn't really make sense since the output of 'echo
foo' is not otherwise used. However, the following fails too:

echo foo | { echo "$(cat) bar" | xsel -pi; xsel -po; }

That one is a typical example of modifying data in a pipe before
passing it on to xsel -i, and then showing the result with an extra
xsel -o. The 'xsel -po' would surely not be expected to affect the
primary selection, but it does; it seems to read from stdin, which is
empty because it has been used up by cat, and put it into the primary
selection, effectively clearing it out.
(You might say "Put the 'xsel -po' outside the '{...}'.", but that
part could as well be a shell function or script, over which we'd have
no control.)

    { 'initial_values'  => {},
      'mdf'             => '/u/mdf/mdf-kospi200-woori2.20100910-10199.pcap',
      'branch'          => 'dev'
    },
  • Loading branch information...
1 parent fba7bfc commit 79748acf3045546a4d8ae444de99bb7a07d16eb7 @kfish committed Dec 9, 2010
Showing with 485 additions and 450 deletions.
  1. +450 −419 aclocal.m4
  2. +4 −4 config.h.in
  3. +31 −27 xsel.c
Oops, something went wrong.

0 comments on commit 79748ac

Please sign in to comment.