Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Conversation

@fractalzombie
Copy link
Contributor

Hot reload added, but you need to install https://github.com/emcrisostomo/fswatch. This package is cross-platform.

Added access log to console.

Some refactoring.

Happy New Year)))

Merge pull request #178 from fractalzombie/develop
Fix for OS Helper.
Added Hot Reload with FSWatch.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 68.11% when pulling ac0c514 on fractalzombie:develop into 6af7b17 on swooletw:develop.

@coveralls
Copy link

coveralls commented Dec 31, 2018

Coverage Status

Coverage increased (+0.05%) to 68.544% when pulling c50a714 on fractalzombie:develop into 6af7b17 on swooletw:develop.

@fractalzombie
Copy link
Contributor Author

fractalzombie commented Dec 31, 2018

Huh... I fix it... laravel helpers are hell.

@albertcht
Copy link
Member

Hi @fractalzombie ,

Thanks a bunch for your pull request, I'll check it and merge it to develop branch by this weekend. :)

@albertcht
Copy link
Member

Happy new year~

public function make(?callable $callback = null)
{
$mcb = function ($type, $buffer) use ($callback) {
if (! $this->locked && AppProcess::OUT === $type && $event = FSEventParser::toEvent($buffer)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the event I got here is always null. So the hot reload didn't get triggered after receiving a fswatch event. Do you have any ideas?

Copy link
Contributor Author

@fractalzombie fractalzombie Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will see, what happens. What OS you use?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using OSX and fswatch 1.14.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using OSX and fswatch 1.14.0.

I'm too...

I fix it.

*/
class FSEventParser
{
protected const REGEX = '/^([\S+]{3}\s+[\S+]{3}\s+[\d+]{2}\s+[\d+]{2}:[\d+]{2}:{0,2}:[\d+]{2}:{0,2}\s+[\d+]{0,4})\s+(\/[\S+]*)\s+([\S+*\s+]*)/mi';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the reason that FSEventParser::toEvent($event) is always null in my environment. I'm using OSX and fswatch 1.14.0. Here's what I received for the fswatch event:

Mon Jan  7 23:30:28 2019 /Users/Albert/Projects/laravel-swoole-demo/vendor/swooletw/laravel-swoole/src/HotReload/FSProcess.php PlatformSpecific Updated IsFile

I haven't tested it on other platforms. But it works for my after changing the regex to:

^([\S+]{3}\s+[\S+]{3}\s+[\d+]{1,2}\s+...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fractalzombie ,

Thank you so much ^^

@albertcht albertcht merged commit d28ff60 into swooletw:develop Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants