django - TextMate Python bundle non-blocking -
django - TextMate Python bundle non-blocking -
i created bundle in textmate restarting current django project's associated supervisor process. running code in python interpreter restarts process without blocking, when utilize textmate bundle (set run every time save .py file) blocks gui ~3 seconds. there way can avoid this?
here's code looks like:
class="lang-py prettyprint-override">#!/usr/bin/env python import os import subprocess import threading projname = os.environ.get('tm_project_directory', '').rpartition('/')[2] def restart_proj(projname=none): """ restart supervisor instance. assumes name of supervisor instance basename tm_project_directory. """ if projname: subprocess.popen('$home/.virtualenvs/supervisor/bin/' \ 'supervisorctl restart {0}'.format(projname), shell=true, stdout=open('/dev/null', 'w')) t = threading.thread(target=restart_proj, args=(projname, )) t.start()
this late, want close close_fds=true set in popen argument. specified, not wait response.
subprocess.popen('$home/.virtualenvs/supervisor/bin/' \ 'supervisorctl restart {0}'.format(projname), shell=true, close_fds=true, stdout=open('/dev/null', 'w')) python django textmate textmatebundles supervisord
Comments
Post a Comment