fix: never use a shell
This commit is contained in:
17
README.md
17
README.md
@@ -10,23 +10,16 @@ use Nih\CommandBuilder\Stdio;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$child = (new Command('/usr/bin/cat'))
|
||||
$child = (new Command('cat'))
|
||||
->stdin(Stdio::piped())
|
||||
->spawn(shell: false);
|
||||
->stdout(Stdio::piped())
|
||||
->spawn();
|
||||
|
||||
$child->stdin?->write('Hello, this is pretty cool.');
|
||||
$child->stdin?->close();
|
||||
|
||||
$output = $child->output();
|
||||
|
||||
var_dump($output)
|
||||
echo $output->stdout;
|
||||
|
||||
// object(Nih\CommandBuilder\Output)#4 (3) {
|
||||
// ["stdout"]=>
|
||||
// string(27) "Hello, this is pretty cool."
|
||||
// ["stderr"]=>
|
||||
// string(0) ""
|
||||
// ["code"]=>
|
||||
// int(0)
|
||||
// }
|
||||
// Hello, this is pretty cool.
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user