gpg issues
Jan Hudec
bulb at ucw.cz
Wed Feb 15 06:39:03 GMT 2006
On Tue, Feb 14, 2006 at 15:04:58 -0600, John A Meinel wrote:
> Using this fake-gpg.py:
>
> #!/usr/bin/env python
> """read from sys.stdin into a temporary file, and then have gpg sign it.
> """
>
> import os, subprocess, sys, tempfile
>
> t = tempfile.NamedTemporaryFile()
> t.write(sys.stdin.read())
>
> p = subprocess.Popen(['gpg', '--output', '-', '--clearsign', t.name],
> stdout=subprocess.PIPE)
>
> out, err = p.communicate()
>
> sys.stdout.write(out)
> sys.exit(p.returncode)
>
> t.close()
>
> And then if I just do:
> ./fake-gpg.py
> test<ENTER>
> ^D<ENTER>
>
> It prompts me for a password correctly, and then does the signature.
> doing
> echo "test" | ./fake-gpg.py
>
> Fails to prompt, and won't sign.
I believe it's because you don't reopen stdin. You need to open the
terminal (the one which stderr is connected to - it would be better to
use your controling tty, but I don't know how to get it) on stdin.
--
Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060215/1701b09a/attachment.pgp
More information about the bazaar
mailing list