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
OpenPGP_0x1A14CB3464CBE5BF.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
