Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Add stringable output to ProcessResult #52857

Closed

Conversation

nuernbergerA
Copy link
Contributor

Hey

im pretty sure @aarondfrancis can tell you why this is cool.


Unfortunately PendingResult isn't macroable but i think its a common thing to work with the output as a stringable.

Currently you need to write this

Str::of(Process::run('ls -l')->output())->match('/some regex/');

With this PR it would be

Process::run('ls -l')->stringable()->match('/some regex/');

alternative API

Process::run('ls -l')->output(stringable: true)->match('/some regex/');

Cheers
Adrian

@nuernbergerA nuernbergerA changed the title [11.x] Add stringable output to PendingResult [11.x] Add stringable output to ProcessResult Sep 19, 2024
@aarondfrancis
Copy link
Contributor

No opinions on the implementation, but I do really want this feature! 😍

Also, damn @nuernbergerA you're so fast!

Comment on lines +42 to +48
/**
* Get the standard output of the process as Stringable.
*
* @return \Illuminate\Support\Stringable
*/
public function stringable();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is not an internal interface, other libraries or apps could extends this class (highly unlikely though). So this would be a change for Laravel 12 in my opinion.

@taylorotwell
Copy link
Member

I don't think we can update that interface on a patch release.

@nuernbergerA
Copy link
Contributor Author

@taylorotwell what are you thoughts on putting the macroable trait on the class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants