File tree Expand file tree Collapse file tree 7 files changed +53
-5
lines changed
Expand file tree Collapse file tree 7 files changed +53
-5
lines changed Original file line number Diff line number Diff line change 33/bin /sca /phpcs.txt
44/bin /sca /phpmd.html
55composer.lock
6+ /.vscode
Original file line number Diff line number Diff line change @@ -3,9 +3,13 @@ language: php
33php :
44 - ' 5.6'
55 - ' 7.0'
6+ - ' 7.1'
7+ - ' 7.2'
8+ - ' 7.3'
9+ - ' 7.4'
610 - hhvm
711 - nightly
8-
12+
913before_install :
1014 - git config --global github.accesstoken $GITHUB_OAUTH_TOKEN
1115 - composer config github-oauth.github.com $GITHUB_OAUTH_TOKEN
Original file line number Diff line number Diff line change 22
33BASEDIR=$( dirname $0 )
44
5- php BASEDIR/../tests/TestRig.php
5+ php $ BASEDIR /../tests/TestRig.php
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env php
2+ <?php
3+ /**
4+ * @title Shows handling of falsy data such as `0` in a loop.
5+ * @command yes 0 | grep 0 | head
6+ * @expected 0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n
7+ */
8+
9+ error_reporting (E_ALL );
10+
11+ include __DIR__ . '/../vendor/autoload.php ' ;
12+
13+ use ElvenSpellmaker \PipeSys as PS ;
14+ use ElvenSpellmaker \PipeSys \Command as Command ;
15+ use ElvenSpellmaker \PipeSys \IO as IO ;
16+
17+ class LoopSystem extends Command \AbstractCommand
18+ {
19+ private $ i = 5 ;
20+
21+ public function getCommand ()
22+ {
23+ while ($ this ->i --)
24+ {
25+ yield new IO \OutputIntent ('0 ' );
26+ echo (yield new IO \ReadIntent ), "\n" ;
27+ }
28+ }
29+ }
30+
31+ $ loopBuffer = new IO \QueueBuffer ;
32+
33+ $ start = new LoopSystem ;
34+ $ end = new LoopSystem ;
35+
36+ $ start ->setStdIn ($ loopBuffer );
37+ $ end ->setStdOut ($ loopBuffer );
38+
39+ $ c = new PS \Scheduler (new Command \StandardConnector );
40+ $ c ->addCommand ($ start );
41+ $ c ->addCommand ($ end );
42+ $ c ->run ();
Original file line number Diff line number Diff line change 44
55use ElvenSpellmaker \PipeSys \Command \CommandInterface ;
66use ElvenSpellmaker \PipeSys \IO \BufferInterface ;
7+ use ElvenSpellmaker \PipeSys \IO \EOF ;
78use ElvenSpellmaker \PipeSys \IO \InvalidBufferException ;
89use ElvenSpellmaker \PipeSys \IO \IOableTrait ;
910use ElvenSpellmaker \PipeSys \IO \OutputIntent ;
@@ -89,7 +90,7 @@ private function attemptRun($firstRun)
8990 $ this ->generator ->next ();
9091 }
9192
92- $ genResponse = $ data
93+ $ genResponse = $ data !== null
9394 ? $ this ->generator ->send ($ data )
9495 : $ this ->generator ->current ();
9596
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ protected function attemptRead()
9393 {
9494 $ data = $ this ->read ($ this ->readIntent ->getChannel ());
9595
96- if ($ data )
96+ if ($ data !== null )
9797 {
9898 $ this ->readIntent = null ;
9999 }
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function read()
9898 }
9999 catch (RuntimeException $ e )
100100 {
101- return false ;
101+ return null ;
102102 }
103103
104104 if (isset ($ this ->block ))
You can’t perform that action at this time.
0 commit comments