-
Notifications
You must be signed in to change notification settings - Fork 389
Added hot reload and access log to console #183
Conversation
Merge pull request #178 from fractalzombie/develop
Fix for OS Helper. Added Hot Reload with FSWatch.
Refactoring.
|
Huh... I fix it... laravel helpers are hell. |
|
Hi @fractalzombie , Thanks a bunch for your pull request, I'll check it and merge it to develop branch by this weekend. :) |
|
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)) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/HotReload/FSEventParser.php
Outdated
| */ | ||
| 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'; |
There was a problem hiding this comment.
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+...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
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 ^^
when date is less then 10
when date is less then 10
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)))