console-parallelization icon indicating copy to clipboard operation
console-parallelization copied to clipboard

Error when command is executed outside bin/ directory.

Open andreas-gruenwald opened this issue 4 years ago • 15 comments

Currently commands that implement the Parallelization trait must be executed in bin/.

Example: cd ~/www/bin && bin/console pimcore:thumbnails:image --processes 1 -> works. Example: cd ~www && ~/www/bin/console pimcore:thumbnails:image --processes 1 -> error message: Expected a string. Got: boolean.

Reason: $consolePath = realpath(getcwd().'/bin/console'); returns false if the script is executed from the home directory (debian).

I don't have a solution right now, but according to https://www.php.net/manual/en/function.getcwd.php:

On some Unix variants, getcwd() will return FALSE if any one of the parent directories does not have the readable or search mode set, even if the current directory does.

andreas-gruenwald avatar May 25 '20 20:05 andreas-gruenwald

Agreed the console path detection could be better, I don't like the current one either

theofidry avatar May 25 '20 23:05 theofidry

@theofidry What if we move that line https://github.com/webmozarts/console-parallelization/blob/1.x/src/Parallelization.php#L379

into a separate method? I can provide a PR if you agree...

andreas-gruenwald avatar Jun 10 '20 08:06 andreas-gruenwald

that would make sense 👍

theofidry avatar Jun 10 '20 08:06 theofidry

that would make sense 👍

Done.

andreas-gruenwald avatar Jun 10 '20 08:06 andreas-gruenwald

Closed via #43

theofidry avatar Nov 29 '20 19:11 theofidry

Hi @theofidry,

Is there a reason this was dropped in 1.2.x?

AlternateIf avatar Apr 01 '21 08:04 AlternateIf

Hi @theofidry,

Is there a reason this was dropped in 1.2.x?

I think in 1.2.1. you tagged based on the master, but it should be tagged based on version 1.x? The method is important as it is overriden in Pimcore.

andreas-gruenwald avatar Apr 06 '21 08:04 andreas-gruenwald

Sorry for the late response, indeed I tagged the wrong branch corrected with 1.2.2

theofidry avatar May 26 '21 15:05 theofidry

Something's not right... v1.2.0 and v1.2.1 are tagged on master, while v1.2.2 is tagged on 1.x (and points to the same commit as v1.1.0), while in the release notes it says that it contains #48, which however was merged into master and not into 1.x.

So when users run composer update, they lose the changes from master that were already in v1.2.0 and v1.2.1.

What should have been done instead is to merge 1.x into master and release this as v1.2.2, I suppose.

jdreesen avatar May 26 '21 17:05 jdreesen

I agree Actually https://github.com/webmozarts/console-parallelization/blob/master/composer.json#L18 is causing the composer conflict now.

brusch avatar Jun 04 '21 08:06 brusch

@theofidry are you going to fix the v1.2.2 release, or should we add a conflict to our composer.json ?

  "conflict": {
    "webmozarts/console-parallelization": "1.2.2",

brusch avatar Jun 04 '21 08:06 brusch

@theofidry any updates on that, actually it would be quite urgent 😐 Thanks in advance!

brusch avatar Jun 07 '21 09:06 brusch

I'll try to have a look next week I'm a bit under water atm

theofidry avatar Jun 10 '21 18:06 theofidry

Ok looks like things got quite messed up: quite a bit of work was introduced on master and master was accidentally released as 1.x. I'll merge back master to 1.x and do a new release. Technically this is introducing BC breaks but given the relatively low usage and because that problematic release has been out for so long I think it's an acceptable solution

theofidry avatar Jul 11 '21 08:07 theofidry

@theofidry Thanks a lot for looking into this, just tested and I can confirm all works now. 👍

brusch avatar Jul 12 '21 13:07 brusch

As of 2.x, by default the current script path will be taken instead of $cwd/bin/console which be more robust and also work outside of a Symfony context.

theofidry avatar Oct 09 '22 07:10 theofidry