unless $cb;
print $foreign_stdin $cb->($line, @_), "\n";
chomp($line = <$sudo_stderr>);
+ die "sent password and expected newline from sudo, got ${line}"
+ if $line;
+ chomp($line = <$sudo_stderr>);
die "sent password but next line was ${line}"
unless $line eq "GO";
} else {
+use IO::Prompter; # dies, utterly, if loaded after strictures, no idea why
use strictures 1;
use Test::More;
use lib 'xt/lib';
use Object::Remote;
+use Object::Remote::Connector::LocalSudo;
+
my $user = $ENV{TEST_SUDOUSER}
or plan skip_all => q{Requires TEST_SUDOUSER to be set};
-my $remote = TestFindUser->new::on($user . '@');
+my $pw;
+
+my $connector = Object::Remote::Connector::LocalSudo->new(
+ password_callback => sub {
+ $pw ||= prompt 'Sudo password', -echo => '*';
+ }
+);
+
+my $remote = TestFindUser->new::on($connector->connect($user));
my $remote_user = $remote->user;
like $remote_user, qr/^\d+$/, 'returned an int';
isnt $remote_user, $<, 'ran as different user';