astorm/pestle

Could not run pestle commands

Elamurugan-Nallathambi opened this issue · 5 comments

When I try

php pestle help
PHP Fatal error: Cannot redeclare Pulsestorm\Pestle\Library\loadJsonFromFile() (previously declared in phar:///var/www/html/cg/library/all.php:13812) in phar:///var/www/html/cg/modules/pulsestorm/pestle/library/module.php on line 11

Environment
PHP : 7.2
Magento : 2.3.3 Commerce Edition

@Elamurugan-Nallathambi Thanks for giving pestle a try -- and sorry it wasn't a smooth first first run experience. We'd like to improve things -- if you have the time can you answer a few questions?

  1. What operating system (Windows, Mac OS, Linux) are you running pestle on?

  2. We see you're typing php pestle -- is that accurate? If so, what's in the file pestle? Is that the pestle.phar file, or a file you created? Or something else?

If you can answer those questions we can start trying to figure out what's going on with your system.

OK, I think I see the problem here. I'm guessing you're running on windows, and using the Git Bash shell. This creates an interesting problem right here: https://github.com/astorm/pestle/blob/master/library/autoload.php#L31

This code is meant to detect if you're running pestle in a packaged way, or just trying to load the full library. The problem is we use the DIRECTORY_SEPARATOR command to split the paths. On a windows system, this is \, but if you're running PHP in git bash on windows, your paths will likely be /. I'm unsure the best way to solve this at the moment other than suggesting a *nix environment like the Windows Ubuntu Sub System.

Filing this under a windows support Milestone to collect issure related to running pestle on windows.

PR to fix git Bash issue here: #513, should go out with the next release.

@ Elamurugan-Nallathambi We didn't hear back from you on your OS version and how you're running pestle. Regardless, we did run into an error with the same message, and we fixed it. It will be going on in Pestle 1.5.1 or pestle 1.6 -- if either of those future versions don't fix your problem please let us know and feel free to reopen this issue.

@astorm Seems like this was windows git bash environment issue only, in osx/ubuntu this does works ok. I don't have the windows machine access currently, I will check pestle new release later and will surely update this issue with the status. Thanks for checking this.