AnyEvent-Subprocess
view release on metacpan or search on metacpan
lib/AnyEvent/Subprocess/Job/Delegate/Pty.pm view on Meta::CPAN
return $self->run_delegate_class->new(
name => $self->name,
direction => 'rw',
handle => $self->handle,
want_leftovers => $self->want_leftovers,
);
}
sub parent_finalize_hook {
my $self = shift;
$self->pty->close_slave;
}
sub child_setup_hook {
my $self = shift;
$self->pty->make_slave_controlling_terminal;
$self->handle->do_not_want;
AnyEvent::Util::fh_nonblocking $self->slave_pty, 0;
for my $fh ($self->redirect_handles){
dup2( fileno($self->slave_pty), fileno($fh) )
or confess "Can't dup2 $fh to slave pty: $!";
}
}
sub build_code_args {}
sub child_finalize_hook {}
sub parent_setup_hook {}
sub receive_child_result {}
sub receive_child_error {}
__PACKAGE__->meta->make_immutable;
1;
=pod
=head1 NAME
AnyEvent::Subprocess::Job::Delegate::Pty - give the child a pseudo-terminal
=head1 VERSION
version 1.102912
=head1 DESCRIPTION
You can have more than one of these, but the last one will become the
controlling tty.
=head1 INITARGS
=head2 redirect_handles
A list of filehandles that will be connected to this Pty in the child.
Defaults to stdout and stderr.
=head1 METHODS
=head2 pty
Returns the L<IO::Pty|IO::Pty> object. You can use this object to set
the child's window size, etc.
=head2 handle
The handle that you can read/write to communicate with the child.
Note that writing can be confusing; because the Pty emulates a
terminal, and terminals echo input, you will get back things that you
write. You can disable this behavior by changing the terminal
parameters in the child process.
(If you don't know what "raw mode" and "cooked mode" are, you should
read up on UNIX terminals. You might really want a pipe, not a pseudo
terminal.)
=head1 AUTHOR
Jonathan Rockway <jrockway@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Rockway.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
__END__
( run in 0.904 second using v1.01-cache-2.11-cpan-39bf76dae61 )