Description
Description
Some processes like ripgrep behave differently depending on whether STDIN is bound to a read pipe or not:
ripgrep will automatically detect if stdin exists and search stdin for a regex
pattern, e.g. 'ls | rg foo'. In some environments, stdin may exist when it
shouldn't. To turn off stdin detection explicitly specify the directory to
search, e.g. 'rg foo ./'.
The subtle difference here is that if you call rg foo
(without bound STDIN), the current directory is searched for "foo" and results are unprefixed (i.e. a match in "bar.txt" is reported as found in "bar.txt"), but if you call rg foo ./
or rg foo .
then the same directory is searched but all results are prefixed, i.e. a match in "bar.txt" is reported as found in "./bar.txt").
AFAICS the current implementation of symfony/process does not allow to unset or change the STDIN read pipe. The proc_open $descriptior_spec parameter is set according to private method getDescriptors, which in my case delegates to UnixPipes (created using new, so no way to override that either), which returns ['pipe', 'r']
at array index 0.
What I would need is a way to either not have array index 0 set at all, or an ability to set it to (PHP built-in const) STDIN
.
So I'd like to have all the benefits of symfony/process (command sanitization, accessing STDOUT and STDERR separately) just without the STDIN handling.
Example
No response