akeeba / fof

Rapid Application Development framework for Joomla!™ 3 and 4
0 stars 0 forks source link

Issue with fof init on Windows #636

Closed f-liva closed 7 years ago

f-liva commented 7 years ago

Hello,

I've followed the instructions at https://github.com/akeeba/fof/wiki/The-FOF-CLI-tool but when I run php fof.phar init and the CLI asks me what's the dev site location, I enter the working joomla installation path and nothing... the CLI tool continues to ask me the location...

C:\xampp\htdocs\joomla364
λ php fof.phar init
Could not find a .fof file. Let me generate it for you
What's the dev site location? [C:\xampp\htdocs\joomla364]
C:\xampp\htdocs\joomla364

The path does not exists
The path does not seem to contain a Joomla! Website
What's the dev site location? [C:\xampp\htdocs\joomla364]
C:\xampp\htdocs\joomla364

The path does not exists
The path does not seem to contain a Joomla! Website
What's the dev site location? [C:\xampp\htdocs\joomla364]
C:\xampp\htdocs\joomla364

The path does not exists
The path does not seem to contain a Joomla! Website
What's the dev site location? [C:\xampp\htdocs\joomla364]
nikosdion commented 7 years ago

I will be looking into that after the 14th when I'll have access to a Windows computer. However, seeing that the message is that the path doesn't exist, have you tried using forward slashes instead of backslashes, e.g. c:/xampp/htdocs/joomla364?

f-liva commented 7 years ago

Same thing with forward slashed, I also tried C:\xamp\htdocs\joomla364 but nothing

f-liva commented 7 years ago

Any news here?

nikosdion commented 7 years ago

I managed to get my Windows environment working again just half an hour ago.

The problem is caused by a bug(?) in PHP. The line input for the CLI application was using Joomla's code for CLI input which does an fread against STDIN. On every OS except Windows this returns the user input. On Windows it returns something like tring(123) where 123 is the length of the read data (including the \r of the \r\n Windows-style line ending). That does look like a bug in PHP. Doing an fgets() on STDIN, however, works a treat o_O

For what it's worth, this does happen no matter if you're using straight up cmd.exe or Cygwin (Bash on native Windows). I didn't check with Bash on Ubuntu on Windows (a.k.a. Windows Subsystem for Linux) because I suspect it wouldn't happen there, since they're essentially running a special Linux kernel that routes low level operations to Windows, meaning that input streams are handled by native Linux code.

ghost commented 7 years ago

It seem's to be working after I've installed Windows Subsystem for Linux. But i really don't recommend to use it.