Problem with piping pass

meator meator.dev at gmail.com
Sun Feb 5 21:26:21 UTC 2023


Hello. I don't know if this behavior should be considered a bug but it 
is kind of strange and it broke my script.

When You do 'pass show -c <PASSWORD>', it outputs 'Copied <PASSWORD> to 
clipboard. Will clear in 45 seconds.' and then it exits. Or so I 
thought. If pass'es stdout is connected to a pseudoterminal, it sure 
exits right away. But if stdout is a pipe, it exits after 45 seconds.

 > time pass -c1 test | cat
Copied test to clipboard. Will clear in 45 seconds.
pass -c1 test  0.05s user 0.05s system 33% cpu 0.284 total
cat  0.00s user 0.00s system 0% cpu 45.328 total
 > time pass -c1 test
Copied test to clipboard. Will clear in 45 seconds.
pass -c1 test  0.03s user 0.05s system 41% cpu 0.217 total
 > time unbuffer pass -c1 test | cat
Copied test to clipboard. Will clear in 45 seconds.
unbuffer pass -c1 test  0.05s user 0.05s system 14% cpu 0.729 total
cat  0.00s user 0.00s system 0% cpu 0.728 total
 > time pass -c1 test > /dev/null
pass -c1 test > /dev/null  0.02s user 0.03s system 30% cpu 0.188 total

(unbuffer is a program that pretty much behaves like cat but with 
pseudoterminals. I learned this trick some time ago. It's surprisingly 
useful.)

It's interesting that the > /dev/null one is still fast. I don't know if 
I'm just misunderstanding pipes but the first command should have exited 
right away as did all other ones in my opinion.

Thank You in advance,
meator

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x1A14CB3464CBE5BF.asc
Type: application/pgp-keys
Size: 3780 bytes
Desc: OpenPGP public key
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20230205/b1d1f126/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 659 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20230205/b1d1f126/attachment.sig>


More information about the Password-Store mailing list