~sircmpwn/aerc

Pass os stdin to credential command v1 PROPOSED

You should set up an out of band pinentry like pinentry-gtk or something
similar. This naive approach will break under many circumstances
because aerc is TUI-based.
Jonas Müller
> Drew DeVault <sir@cmpwn.com> hat am 8. August 2019 um 03:34 geschrieben:
> This naive approach will break under many circumstances
> because aerc is TUI-based.
Can you elaborate? As far as I could see, the only place where the function is called is during `config.LoadConfigFromFile()`, at which point there is no UI present which could expect input from STDIN. Furthermore, it seems strange to call out to a `source-cred-command` and not yield STDIN to that command, so that it can satisfy its prompt. 

Does this mean that any `pinentry` command would need to run through a different `tty`?
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/%3C20190807152705.66435-1-jonas-mueller%40mailbox.org%3E/mbox | git am -3
Learn more about email & git

[PATCH] Pass os stdin to credential command Export this patch

Jonas Mueller
This is neccessary for `gpg-agent` to display a prompt and get the key
to unlock a given password. See https://todo.sr.ht/~sircmpwn/aerc2/250.
---
 config/config.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config/config.go b/config/config.go
index bfcbecf..5736678 100644
--- a/config/config.go
+++ b/config/config.go
@@ -204,6 +204,7 @@ func parseCredential(cred, command string) (string, error) {
 	}
 
 	cmd := exec.Command("sh", "-c", command)
+	cmd.Stdin = os.Stdin
 	output, err := cmd.Output()
 	if err != nil {
 		return "", fmt.Errorf("failed to read password: %s", err)
-- 
2.22.0
You should set up an out of band pinentry like pinentry-gtk or something
similar. This naive approach will break under many circumstances
because aerc is TUI-based.
View this thread in the archives