OK thanks to Zentara, my code now looks like...

#!/usr/bin/perl
use warnings;
use strict;
use IPC::Open3;

local $SIG{CHLD} = 'IGNORE';
local $SIG{PIPE} = 'IGNORE';

my $childpid = open3(\*IN, \*OUT, \*ERR, 'gpg --no-greeting --no-tty --command-fd 0 --status-fd 1 --edit root');

print IN "trust\n5\ny\n";
close IN;

my(@answer,@err);

 @answer = <OUT>;
 print "out->@answer\n";

 @err = <ERR>;
 print "err->@err\n";


Unfortunately, while this does appear to interact with gpg outside the standard tty, it doesn't actually appear to do what the commands that I am passing to gpg should. Running it produces...

out->[GNUPG:] GET_LINE keyedit.prompt
 [GNUPG:] GOT_IT
 [GNUPG:] GET_LINE edit_ownertrust.value
 [GNUPG:] GOT_IT
 [GNUPG:] GET_BOOL edit_ownertrust.set_ultimate.okay
 [GNUPG:] GOT_IT
 [GNUPG:] GET_LINE edit_ownertrust.value
 [GNUPG:] GOT_IT
 [GNUPG:] GET_LINE keyedit.prompt
 [GNUPG:] GOT_IT

err->

which looks like it is doing as expected, but the trust status of the key remains unchanged. It seems that we're so close...

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to