Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow to create process without STDIN read pipe #57863

Copy link
Copy link
Open
@InvisibleSmiley

Description

@InvisibleSmiley
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.