diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..c995603 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,14 @@ +# Notes + +## xclip hangs in subshell environment + +In certain situations xclip is known to wait infinatly. +According to this: + +- [Stackoverflow](https://stackoverflow.com/questions/19237559/why-xclip-bashrc-takes-much-longer-than-systemxclip-bashrc-in-ruby) +- [Sourceforge](http://sourceforge.net/p/xclip/bugs/9/) + +This is related to xclip not closing stdout. + +To mitigate this I will try to close stdout and stderr within the +accountmanager.sh script. diff --git a/accountmanager.sh b/accountmanager.sh index 3e30567..fc042a7 100644 --- a/accountmanager.sh +++ b/accountmanager.sh @@ -266,7 +266,7 @@ function amngradd() { PASSWORD="$(amngrcrypt -r "${RECIPIENT}" -- "${3}")" else PASSWORD="$(amngrgen -r "${RECIPIENT}")" - echo -n "${PASSWORD}" | gpg -dq | xclip -i + echo -n "${PASSWORD}" | gpg -dq | xclip -i >&- fi if [ -z "${PASSWORD}" ] @@ -359,7 +359,7 @@ function amngrgetuser() { if [ $STDOUT -eq 0 ] then sqlite3 "${DB}" <<-EOD |\ - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i >&- SELECT user FROM account JOIN account_cred ON account.id=account_cred.account_id JOIN cred ON cred.id=account_cred.cred_id @@ -411,7 +411,7 @@ function amngrgetpass() { test "${STATE}" != "1" -a "${STATE}" != "2" && STATE="1" sqlite3 "${DB}" <<-EOD |\ - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i >&- SELECT pass FROM account JOIN account_cred ON account.id=account_cred.account_id JOIN cred ON cred.id=account_cred.cred_id