sub handle_create {
my ($self, $on, %args) = @_;
+ 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");
+ $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.
# actually, we should register with a monotonic id and
# stash the pid elsewhere. but meh for now.
my $pid = $client->do(meta => 'pid');
- my $name = ($on||'|').':'.$pid;
+ my $name = $on.':'.$pid;
my $conn_router = Tak::Router->new;
$conn_router->register(local => $connection->receiver->service);
$conn_router->register(remote => $connection);
sub _open {
my ($self, $on, @args) = @_;
- unless ($on) {
- my $kid_pid = IPC::Open2::open2(my $kid_out, my $kid_in, $^X, '-', '-', @args)
+ if ($on eq '-') {
+ 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);
}