File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44use Clue \React \Ami \Client ;
55use Clue \React \Ami \Api ;
66use Clue \React \Ami \Protocol \Response ;
7- use Clue \React \Ami \Protocol \Event ;
8- use Clue \React \Ami \Protocol \ErrorException ;
97
108require __DIR__ . '/../vendor/autoload.php ' ;
119
2422 echo 'Commands: ' . implode (', ' , array_keys ($ response ->getParts ())) . PHP_EOL ;
2523 });
2624
27- $ client ->on ('close ' , function () {
25+ $ client ->on ('close ' , function () use ( $ loop ) {
2826 echo 'Closed ' . PHP_EOL ;
27+
28+ $ loop ->removeReadStream (STDIN );
2929 });
3030
3131 $ loop ->addReadStream (STDIN , function () use ($ api ) {
3232 $ line = trim (fread (STDIN , 4096 ));
3333 echo '< ' . $ line . PHP_EOL ;
3434
3535 $ api ->command ($ line )->then (
36- function (Response $ response ) {
36+ function (Response $ response ) {
3737 echo $ response ->getPart ('_ ' ) . PHP_EOL ;
3838 },
39- function (ErrorException $ error ) use ($ line ) {
39+ function (Exception $ error ) use ($ line ) {
4040 echo 'Error executing " ' . $ line . '": ' . $ error ->getMessage () . PHP_EOL ;
4141 }
4242 );
You can’t perform that action at this time.
0 commit comments