Commit ef0d123efa1a7e09de7f972286751c43b529399a

Authored by Georg GH. Hopp
2 parents 0c5dbbeb 31b93e82

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
Showing 2 changed files with 17 additions and 3 deletions
  1 +# Notes
  2 +
  3 +## xclip hangs in subshell environment
  4 +
  5 +In certain situations xclip is known to wait infinatly.
  6 +According to this:
  7 +
  8 +- [Stackoverflow](https://stackoverflow.com/questions/19237559/why-xclip-bashrc-takes-much-longer-than-systemxclip-bashrc-in-ruby)
  9 +- [Sourceforge](http://sourceforge.net/p/xclip/bugs/9/)
  10 +
  11 +This is related to xclip not closing stdout.
  12 +
  13 +To mitigate this I will try to close stdout and stderr within the
  14 +accountmanager.sh script.
@@ -266,7 +266,7 @@ function amngradd() { @@ -266,7 +266,7 @@ function amngradd() {
266 PASSWORD="$(amngrcrypt -r "${RECIPIENT}" -- "${3}")" 266 PASSWORD="$(amngrcrypt -r "${RECIPIENT}" -- "${3}")"
267 else 267 else
268 PASSWORD="$(amngrgen -r "${RECIPIENT}")" 268 PASSWORD="$(amngrgen -r "${RECIPIENT}")"
269 - echo -n "${PASSWORD}" | gpg -dq | xclip -i 269 + echo -n "${PASSWORD}" | gpg -dq | xclip -i >&-
270 fi 270 fi
271 271
272 if [ -z "${PASSWORD}" ] 272 if [ -z "${PASSWORD}" ]
@@ -359,7 +359,7 @@ function amngrgetuser() { @@ -359,7 +359,7 @@ function amngrgetuser() {
359 if [ $STDOUT -eq 0 ] 359 if [ $STDOUT -eq 0 ]
360 then 360 then
361 sqlite3 "${DB}" <<-EOD |\ 361 sqlite3 "${DB}" <<-EOD |\
362 - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i 362 + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i >&-
363 SELECT user FROM account 363 SELECT user FROM account
364 JOIN account_cred ON account.id=account_cred.account_id 364 JOIN account_cred ON account.id=account_cred.account_id
365 JOIN cred ON cred.id=account_cred.cred_id 365 JOIN cred ON cred.id=account_cred.cred_id
@@ -411,7 +411,7 @@ function amngrgetpass() { @@ -411,7 +411,7 @@ function amngrgetpass() {
411 test "${STATE}" != "1" -a "${STATE}" != "2" && STATE="1" 411 test "${STATE}" != "1" -a "${STATE}" != "2" && STATE="1"
412 412
413 sqlite3 "${DB}" <<-EOD |\ 413 sqlite3 "${DB}" <<-EOD |\
414 - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i 414 + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i >&-
415 SELECT pass FROM account 415 SELECT pass FROM account
416 JOIN account_cred ON account.id=account_cred.account_id 416 JOIN account_cred ON account.id=account_cred.account_id
417 JOIN cred ON cred.id=account_cred.cred_id 417 JOIN cred ON cred.id=account_cred.cred_id
Please register or login to post a comment