Core LibraryunreleasedAPI Reference

Choose documentation 2

latest

Current version

latest
English

Unreleased LibTmux has not been released. Its API may change during development. This site's structure and URLs may change too.

class libtmux-perl latest

Server

Optional Future facade over the core protocol

Source and package
Qualified name
LibTmux::Async::Server
Module
LibTmux::Async
Package
LibTmux-Async
Source
packages/async/lib/LibTmux/Async/Server.pm

Description#

SYNOPSIS

use v5.44;
use IO::Async::Loop::Ppoll;
use LibTmux::Async::Server;
my $loop = IO::Async::Loop::Ppoll->new;
my $server = LibTmux::Async::Server->new(loop => $loop, socket_name => 'owned');
my $capture = $server->snapshot;
$loop->await($capture);
my $panes = $capture->get->panes->where({ active => true });
$loop->await($server->close);

Examples#

Complete installed-package program with an owned tmux fixture and result/cleanup assertions. View source

use v5.44;
use FindBin;
use lib "$FindBin::Bin/../scripts/lib";
use IO::Async::Loop::Ppoll;
use Future::AsyncAwait;
use LibTmux::Async::Server;
use LibTmuxFixture;
async sub capture_count ($server) {
my $snapshot = await $server->snapshot;
my $count = $snapshot->panes->count;
await $server->close;
return $count;
}
LibTmuxFixture->run(
sub ($sync, $root) {
$sync->new_session(
name => 'await-example',
command => ['/bin/sleep', '120']
);
my $loop = IO::Async::Loop::Ppoll->new;
my $server = LibTmux::Async::Server->new(
loop => $loop,
socket_path => "$root/s",
executable => $ENV{LIBTMUX_TEST_TMUX} // 'tmux'
);
my $work = capture_count($server);
$loop->await($work);
die 'await result differs' unless $work->get == 1;
say 'optional caller await syntax: ok';
}
);

Members43#

Collections and queries3#

Common operations32#

Other members8#

Esc

Type to search.

Reference previewOpen reference