feat: first impl
This commit is contained in:
26
example.php
Normal file
26
example.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Nih\CommandBuilder\Command;
|
||||
use Nih\CommandBuilder\Stdio;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$output = (new Command('echo'))
|
||||
->arg('-n')
|
||||
->arg('-')
|
||||
->arg("./ \$wow '''/stdout.txt")
|
||||
->stderr(Stdio::null())
|
||||
->output();
|
||||
|
||||
var_dump($output);
|
||||
|
||||
$child = (new Command('/usr/bin/cat'))
|
||||
->stdin(Stdio::piped('r'))
|
||||
->spawn(shell: true);
|
||||
|
||||
$child->stdin?->write('Hello, this is pretty cool.');
|
||||
$child->stdin?->close();
|
||||
|
||||
$output = $child->output();
|
||||
|
||||
var_dump($output);
|
||||
Reference in New Issue
Block a user