Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changed taskExec to use symfony process placeholders #1038
base: 3.x
Are you sure you want to change the base?
Changed taskExec to use symfony process placeholders #1038
Changes from all commits
f06df01
0da2288
4fbd183
19fe043
3a87e4a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since escapeArgument is only used for display purposes in taskExec, maybe we should retain the existing implementation. The new version might have some benefits for Windows, but since it will only be used by code that calls
escape
directly, it would make an odd edge case if the changed version caused problems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm undecided about this; if we don't update the implementation, then the printed string won't exactly match the string that Symfony is actually exec'ing, which could be odd. Then again, you could also get into that situation if you ended up with an older version of Symfony that has a different implementation of escape. I'm not sure if our Composer version constraints on our dependencies allows that, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symfony Process is set at 4.4.11 min, and escapeArgument has been changed to this implementation since at least 4.1.7.
Besides, that method was set as deprecated and meant to be removed in Robo 2.0, with a E_USER_DEPRECATED triggered. I don't think anybody would be really surprised it finally gets changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I am wondering if this PR is in fact breaking, since you have changed the contract on
getCommand()
. This isn't just relevant for unit tests; Robo usesgetCommand()
for a number of things, and if this method starts returning a string that contains placeholder instead of a string with escaped arguments, then code that called getCommand and passed it to some process execution function would fail.Would it work out to make
getCommandDescription()
continue to call / returngetCommand()
, havegetCommand()
callreplacePlaceholders
, and add a new methodgetCommandTemplate()
that returns the command string with placeholders, and use that inTask\Exec::run()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I've just tested outside of taskExec, and it does break on other commands : most command include a custom
run()
function, so placeholders don't get replaced.Something I've noticed on other commands is that
getCommand()
is often used to display the command to be executed, whengetCommandDescription()
should be used instead.In any case, there's more than
Exec::run()
that needs replacing, but every run() method that uses theExecOnCommand
trait, since they all get their arguments fromCommandArguments
and need to have their placeholders replaced.As far as I know, only
Exec
has a custom process creation, every other calling theExecCommand::executeCommand()
method. It would simply be a matter of overwriting it in anExecOneCommand::executeCommand()
method that would handle placeholders.So to sum things up :
getCommandTemplate()
method ;ExecOneCommand::executeOneCommand()
to replace placeholders.Sounds good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that sounds good.