-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Changes made to support php artisan schedule:run on windows #7887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t php artisan schedule:run > NUL 2>&1 & on windows
php artisan schedule:run > /dev/null 2>&1 & |
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.
You can turn this into a one-liner like this:
return strncasecmp(PHP_OS, 'WIN', 3) == 0;
@uwascan @franzliedke 👎 as for PHP_OS constant keep in mind this constant will contain the operating system PHP was built on but not it runs on |
@uwascan sudo for windows might look like |
@uwascan protected $output = '/dev/null'; and looks to be never changed. if (is_null($this->output) || $this->output == '/dev/null')
{
...
} In such places it might require to change to something like if (is_null($this->output) || $this->isOutputToNull())
{
...
} with platform dependent implementation |
@uwascan You're one of the few lucky windows users :) as it requires more that just a couple of lines I would suggest asking @taylorotwell or/and @GrahamCampbell if they accept such changes. |
To add to the above you need to use tabs, not spaces. |
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.
Remove this file from your PR.
Please fix the total cs mess. |
Thank you all for your contributions. I realize now that I need to follow Laravel coding standards next time. I will clean up the code and try again. That was my first PR ever, imagine the excitement. |
Another simple way to make this work on windows without changing Laravel code is to append the following to your sheduler code
Example
the code below works on windows when sending output to a file.
This is what I am currently using (with a windows based cron service [http://www.intelliadmin.com/index.php/2011/11/cron-service-for-windows/]) and all is good so far. I think this should be added to the docs. |
Or use Symfony Process with disableOutput()? http://symfony.com/doc/current/components/process.html#disabling-output |
Changes made to src/Illuminate/Console/Scheduling/Event.php to support 'php artisan schedule:run > NUL 2>&1 &' on windows since '/dev/null' does not exist in windows environment.