fix: handle stdio properly
This commit is contained in:
17
examples/plumbing.php
Normal file
17
examples/plumbing.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Nih\CommandBuilder\Command;
|
||||
use Nih\CommandBuilder\Stdio;
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$echo = (new Command('echo'))
|
||||
->arg('Hello, World!')
|
||||
->stdout(Stdio::piped())
|
||||
->spawn();
|
||||
|
||||
$cat = (new Command('cat'))
|
||||
->stdin(Stdio::stream($echo->stdout))
|
||||
->status();
|
||||
|
||||
// Prints "Hello, World!\n"
|
||||
Reference in New Issue
Block a user