aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Salomonsson <plattfot@gmail.com>2020-05-11 16:54:25 -0700
committerFredrik Salomonsson <plattfot@gmail.com>2020-05-11 16:54:25 -0700
commit1ee09915d699f72e90a0d74aae827f60f0e48e8c (patch)
tree582c9dad009d02e12f29ca01f48278b4d89c3d5f
parentbe8637cf2892bc65c1a5e55f24e36a9c4593d830 (diff)
downloadpinentry-rofi-1ee09915d699f72e90a0d74aae827f60f0e48e8c.tar.gz
Add missing '-input /dev/null' to rofi when asking for password (#9)
When refactoring this got removed. Which hangs the input when running via gpg. It doesn't show up when running `pinentry-rofi` directly. The hang is pretty nasty as well, as input to other programs stop working. Only way is to open up a new terminal and find the PID and kill it.
-rwxr-xr-xpinentry-rofi.scm24
1 files changed, 12 insertions, 12 deletions
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm
index 8b154c6..f5ab3cf 100755
--- a/pinentry-rofi.scm
+++ b/pinentry-rofi.scm
@@ -322,18 +322,18 @@ Return the input from the user if succeeded else #f."
'()))
(rofi-sh `("env"
,(string-join
- (map (lambda (x) (format #f "~a=~a" (car x) (cdr x))) env))
+ (map (lambda (x) (format #f "~a=~s" (car x) (cdr x))) env))
,(format #f "rofi -dmenu -disable-history -l ~a -i"
(if (list? buttons) (length buttons) 1))
,(if (and only-match buttons) "-only-match" "")
+ ,(if (not buttons) "-input /dev/null" "")
,(if visibility "" "-password")
,(format #f "-p ~s" prompt)
,(if message (format #f "-mesg ~s" message) "")))
(pipe (open-pipe (string-join (concatenate `(,inputs ,rofi-sh))) OPEN_READ))
(pass (get-string-all pipe))
(status (close-pipe pipe)))
- (when (and (equal? (status:exit-val status) 0) (not (string-empty? pass)))
- pass)))
+ (if (and (equal? (status:exit-val status) 0)) pass #f)))
(define (compose-message pinentry)
"Create the message by combining the error and desc from PINENTRY"
@@ -352,15 +352,15 @@ Return the input from the user if succeeded else #f."
#:message (compose-message pinentry)
#:visibility (pinentry-visibility pinentry)
#:env `(("DISPLAY" . ,(pinentry-display pinentry))))))
- (if pass
- (begin
- (format #t "D ~a" pass)
- (force-output)
- (set-pinentry-ok! pinentry #t))
- (begin
- (format #t "ERR 83886179 Operation cancelled <rofi>\n")
- (force-output)
- (set-pinentry-ok! pinentry #f)))))
+ (if (not (string-empty? (string-trim-both pass)))
+ (begin
+ (format #t "D ~a" pass)
+ (force-output)
+ (set-pinentry-ok! pinentry #t))
+ (begin
+ (format #t "ERR 83886179 Operation cancelled <rofi>\n")
+ (force-output)
+ (set-pinentry-ok! pinentry #f)))))
regex-match))
(define (pinentry-confirm pinentry line confirm-program)