Workaround for constructor signature change in Symfony/Process#2766
Merged
bobdenotter merged 2 commits into4.2from Aug 13, 2021
Merged
Workaround for constructor signature change in Symfony/Process#2766bobdenotter merged 2 commits into4.2from
bobdenotter merged 2 commits into4.2from
Conversation
stloyd
reviewed
Aug 12, 2021
Comment on lines
+46
to
+50
| try { | ||
| $process = new Process($command); | ||
| } catch (\TypeError $e) { | ||
| $process = new Process([$command]); | ||
| } |
There was a problem hiding this comment.
Safer would be:
Suggested change
| try { | |
| $process = new Process($command); | |
| } catch (\TypeError $e) { | |
| $process = new Process([$command]); | |
| } | |
| $process = Process::fromShellCommandline($command); |
Member
Author
There was a problem hiding this comment.
I will try that out.. If that works, that'll be a lot less fugly!
Thanks for the suggestion, @stloyd!
Member
Author
There was a problem hiding this comment.
Alas, it doesn't seem to work in the context of composer create-project, because it seems that method isn't present yet in symfony/process 2.8.x, as used by Composer.
It breaks with this error:
…
…
120 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Run composer recipes at any time to see the status of your Symfony recipes.
> Bolt\ComposerScripts\ProjectEventHandler::postUpdate
! [NOTE] Running composer "post-update-cmd" scripts
PHP Fatal error: Uncaught Error: Call to undefined method Symfony\Component\Process\Process::fromShellCommandline() in /Users/bob/Sites/Bolt/playground/vendor/bolt/core/bin/composer-script/Script.php:39
Stack trace:
#0 /Users/bob/Sites/Bolt/playground/vendor/bolt/core/bin/composer-script/PostUpdateScript.php(13): Bolt\ComposerScripts\Script::run('php vendor/bobd...')
#1 /Users/bob/Sites/Bolt/playground/vendor/bolt/core/bin/composer-script/ProjectEventHandler.php(44): Bolt\ComposerScripts\PostUpdateScript::execute()
#2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(377): Bolt\ComposerScripts\ProjectEventHandler::postUpdate(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(236): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript('Bolt\\ComposerSc...', 'postUpdate', Object(Composer\Script\Event))
#4 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(117): Composer\EventDispatcher\EventDispatc in /Users/bob/Sites/Bolt/playground/vendor/bolt/core/bin/composer-script/Script.php on line 39
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The important part of this PR is:
This was fun to figure out! (not)