| 1 | package Net::SSH::Any::OS::_Base::DPipe; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Net::SSH::Any::Constants (); | ||
| 7 | use Net::SSH::Any::Util qw($debug _debug _debug_hexdump); | ||
| 8 | |||
| 9 | require Net::SSH::Any::DPipe; | ||
| 10 | require IO::Handle; | ||
| 11 | our @ISA = qw(Net::SSH::Any::DPipe | ||
| 12 | IO::Handle); | ||
| 13 | |||
| 14 | sub _any { ${*{shift()}}{_ssha_os_any} } | ||
| 15 | sub _proc { ${*{shift()}}{_ssha_os_proc} } | ||
| 16 | |||
| 17 | sub _upgrade_fh_to_dpipe { | ||
| 18 | my ($class, $dpipe, $any, $proc) = @_; | ||
| 19 | bless $dpipe, $class; | ||
| 20 | ${*$dpipe}{_ssha_os_any} = $any; | ||
| 21 | ${*$dpipe}{_ssha_os_proc} = $proc; | ||
| 22 | $dpipe | ||
| 23 | } | ||
| 24 | |||
| 25 | sub close { | ||
| 26 | my $dpipe = shift; | ||
| 27 | my $ok = 1; | ||
| 28 | $dpipe->_close_fhs or undef $ok; | ||
| 29 | my $any = $dpipe->_any; | ||
| 30 | my $proc = delete ${*$dpipe}{_ssha_os_proc}; | ||
| 31 | $any->_wait_ssh_proc($proc) or undef $ok; | ||
| 32 | $any->_remap_child_error($proc); | ||
| 33 | $? = $proc->{rc}; | ||
| 34 | $any->_check_child_error or undef $ok; | ||
| 35 | return $ok; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub error { shift->_any->error } | ||
| 39 | |||
| 40 | 1; |