Skip to content
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

Solving many bugs when using artisan #28

Closed
wants to merge 2 commits into from
Closed

Solving many bugs when using artisan #28

wants to merge 2 commits into from

Conversation

bvangraafeiland
Copy link

Previously, many artisan commands didn't work well (try routes, list, or migrate:make), due to incorrect use of the Popen class. These have been fixed. Changes of #25 are included in this pull request as well.

Output from artisan commands is now always shown in a panel, and no distinction between successful execution or failure is made; in either case, the response from artisan is displayed in the panel.

@gnarula
Copy link
Owner

gnarula commented Jun 17, 2013

Hey! Thanks for the pull request. I got my macbook back working today so I can continue with the development of the plugin now. I regret for the inactivity during the last few weeks. Reviewing this ASAP.

EDIT: is the commit checked against Windows? I recall users having issues with it. I'll take a while to get working on a Win environment.

Thanks once again

Gaurav

@bvangraafeiland
Copy link
Author

Uh, actually it's only been checked against Windows.

self.proc_status(proc)
except IOError:
sublime.status_message('IOError - command aborted')

def proc_status(self, proc):
if proc.poll() is None:
sublime.set_timeout(lambda: self.proc_status(proc), 200)
Copy link
Author

Choose a reason for hiding this comment

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

This was causing a deadlock if there was a sufficient amount of console output. See also http://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait

@bvangraafeiland
Copy link
Author

Well to be honest currently it's not that smooth either, ST freezes completely while executing the commands, which can be really noticeable when doing things which take a bit longer, such as migrations. It would be better to execute them in another thread, although some refactoring will probably be needed for that. See also this one: https://github.com/francodacosta/composer-sublime. In there, the output is just printed real time, while not blocking the entire program. I'm still very much a newbie at ST plugins and Python for that matter, I guess.

@gnarula
Copy link
Owner

gnarula commented Jun 23, 2013

After applying this patch or even in the last commit? Earlier sublime.set_timeout() was being used to prevent the plugin from blocking the main thread and it worked well iirc. Yes, we'll have to refactor some code undoubtedly to implement threading.

@bvangraafeiland
Copy link
Author

Hm, after this commit, I'd suggest not pulling it yet now that you mention it. I replaced your set_timeout() with a while loop which runs until the command is finished, thus blocking. Using the timeout on the other hand, caused a deadlock with poll() because communicate() wasn't being used. Anyway, I'll try to see how that other plugin handles it and then refactor the code to do that as well.

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.

None yet

2 participants