package Tak::ConnectorService;
use IPC::Open2;
+use IO::Socket::UNIX;
use IO::All;
use Tak::Router;
use Tak::Client;
die [ mistake => "No target supplied to create" ] unless $on;
my $log_level = $args{log_level}||'info';
my ($kid_in, $kid_out, $kid_pid) = $self->_open($on, $log_level);
- $kid_in->print($Tak::STDIONode::DATA, "__END__\n") unless $on eq '-';
- # Need to get a handshake to indicate STDIOSetup has finished
- # messing around with file descriptors, otherwise we can severely
- # confuse things by sending before the dup.
- my $up = <$kid_out>;
- die [ failure => "Garbled response from child: $up" ]
- unless $up eq "Ssyshere\n";
+ unless ($on =~ /^\.?\//) {
+ $kid_in->print($Tak::STDIONode::DATA, "__END__\n") unless $on eq '-';
+ # Need to get a handshake to indicate STDIOSetup has finished
+ # messing around with file descriptors, otherwise we can severely
+ # confuse things by sending before the dup.
+ my $up = <$kid_out>;
+ die [ failure => "Garbled response from child: $up" ]
+ unless $up eq "Ssyshere\n";
+ }
my $connection = Tak::ConnectionService->new(
read_fh => $kid_out, write_fh => $kid_in,
listening_service => Tak::Router->new
my $kid_pid = IPC::Open2::open2(my $kid_out, my $kid_in, 'tak-stdio-node', '-', @args)
or die "Couldn't open2 child: $!";
return ($kid_in, $kid_out, $kid_pid);
+ } elsif ($on =~ /^\.?\//) { # ./foo or /foo
+ my $sock = IO::Socket::UNIX->new($on)
+ or die "Couldn't open socket ${on}: $!";
+ return ($sock, $sock, 'UNIX');
}
my $ssh = $self->ssh->{$on} ||= Net::OpenSSH->new($on);
$ssh->error and