Browse Source

Merge branch 'fix/hang-in-subshell-environment' into 'master'

Fix/hang in subshell environment

This should fix the problem that the script does not work in a subshell environment.

See merge request !1
master
Georg Hopp 8 years ago
parent
commit
ef0d123efa
  1. 14
      NOTES.md
  2. 6
      accountmanager.sh

14
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.

6
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

Loading…
Cancel
Save