Skip to content

Problem with manual running of Artisan tasks #1165

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

Merged
merged 1 commit into from
Sep 10, 2012

Conversation

JoostK
Copy link
Contributor

@JoostK JoostK commented Sep 3, 2012

When running an Artisan task from within your application using Command::run, it fails when the same task is ran more than once. Every time the task is resolved, its file is included using require leading to duplicate class definitions. By using require_once this problem is avoided.

When running an Artisan task from within your application using `Command::run`, it fails when the same task is ran more than once. Every time the task is resolved, its file is included using `require` leading to duplicate class definitions. By using `require_once` this problem is avoided.
@franzliedke
Copy link
Contributor

Nice catch. 👍

@travisbot
Copy link

This pull request fails (merged a1c7dde into ec13efb).

@travisbot
Copy link

This pull request passes (merged 42be48a6 into ec13efb).

@travisbot
Copy link

This pull request passes (merged 8eb083a9 into ec13efb).

@travisbot
Copy link

This pull request passes (merged 007f97f8 into ec13efb).

@jasonlewis
Copy link
Contributor

Travis is reporting that this is failing, any ideas why?

Apart from that I think this is a good catch, I've not run tasks like this before.

@JoostK
Copy link
Contributor Author

JoostK commented Sep 8, 2012

I have no idea why this would fail. I don't yet have the tests installed so I can't run the tests myself, however I suspect it was a one-time glitch while running the tests. I don't know if an exit status of 1 indicates a test failure, or another failure?

I use this method because I have some code which uses exec to start a second php process to run a task in parallel, something like:

exec("php $artisan $task &> /dev/null &");

However, if exec is not available then I run the task directly using Command::run (also easy when testing because then you get any errors in your tasks directly in the browser)

@franzliedke
Copy link
Contributor

Looks like they had some internal problems there. Usually, you'd expect to see some output from PHPUnit when tests are failing...

@JoostK
Copy link
Contributor Author

JoostK commented Sep 8, 2012

Yes, that's what I'm thinking.

Note however that this is a change that affects running tasks themselves, so if this has broken the running of tasks, the test task can't be run either ;)

@JoostK
Copy link
Contributor Author

JoostK commented Sep 9, 2012

Just updated from 3.2.3 to 3.2.7 and ran the unit tests, all fine here.

$ php artisan test:core
PHPUnit 3.6.12 by Sebastian Bergmann.

Configuration read from /Users/Joost/Sites/___/phpunit.xml

...............................................................  63 / 248 ( 25%)
............................................................... 126 / 248 ( 50%)
............................................................... 189 / 248 ( 76%)
...........................................................

Time: 3 seconds, Memory: 10.00Mb

OK (248 tests, 567 assertions)

@daylerees
Copy link
Contributor

It makes sense to me, let's see if this kills the tests ;)

daylerees added a commit that referenced this pull request Sep 10, 2012
Problem with manual running of Artisan tasks
@daylerees daylerees merged commit a5bb035 into laravel:develop Sep 10, 2012
zoe-edwards pushed a commit to zoe-edwards/laravel that referenced this pull request Oct 14, 2013
Added ability to pass Closure to union statement in query builder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants