xref: /php-uv/tests/800-uv_tty.phpt (revision 0a9ac7b8)
1--TEST--
2Check for uv_tty
3--SKIPIF--
4<?php
5if (function_exists("posix_isatty") && defined("STDIN") && !posix_isatty(STDIN)) {
6    die("skip test requiring a tty\n");
7}
8?>
9--FILE--
10<?php
11uv_fs_open(uv_default_loop(), "/dev/tty", UV::O_RDONLY, 0, function($r) {
12    $tty = uv_tty_init(uv_default_loop(), $r, 1);
13    uv_tty_get_winsize($tty, $width, $height);
14    if ($width >= 0) {
15        echo "OK\n";
16    }
17    if ($height >= 0) {
18        echo "OK\n";
19    }
20});
21
22uv_run();
23--EXPECT--
24OK
25OK
26