-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes a bug whereby
0
is interpreted as falsy
* Fixes a bug whereby an input of `0` wouldn't clear the buffer and wouldn't reset the `readIntent` status leading to pipelines potentially becoming completely blocked on reading * Changes a `false` to `null` in QueueBuffer * Adds all the new PHP 7 versions to the Travis build * Ignores the `.vscode` folder * Corrects build script (how was this working before???) * Adds a test to show the above behaviour is fixed
- Loading branch information
1 parent
02feb75
commit 361a516
Showing
7 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/bin/sca/phpcs.txt | ||
/bin/sca/phpmd.html | ||
composer.lock | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
BASEDIR=$(dirname $0) | ||
|
||
php BASEDIR/../tests/TestRig.php | ||
php $BASEDIR/../tests/TestRig.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* @title Shows handling of falsy data such as `0` in a loop. | ||
* @command yes 0 | grep 0 | head | ||
* @expected 0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n | ||
*/ | ||
|
||
error_reporting(E_ALL); | ||
|
||
include __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use ElvenSpellmaker\PipeSys as PS; | ||
use ElvenSpellmaker\PipeSys\Command as Command; | ||
use ElvenSpellmaker\PipeSys\IO as IO; | ||
|
||
class LoopSystem extends Command\AbstractCommand | ||
{ | ||
private $i = 5; | ||
|
||
public function getCommand() | ||
{ | ||
while($this->i--) | ||
{ | ||
yield new IO\OutputIntent('0'); | ||
echo (yield new IO\ReadIntent), "\n"; | ||
} | ||
} | ||
} | ||
|
||
$loopBuffer = new IO\QueueBuffer; | ||
|
||
$start = new LoopSystem; | ||
$end = new LoopSystem; | ||
|
||
$start->setStdIn($loopBuffer); | ||
$end->setStdOut($loopBuffer); | ||
|
||
$c = new PS\Scheduler(new Command\StandardConnector); | ||
$c->addCommand($start); | ||
$c->addCommand($end); | ||
$c->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters