def run(self): self.started = time.time() tid = gs.begin(DOMAIN, self.message, set_status=False, cancel=self.cancel) try: try: self.p = gs.popen(self.cmd, shell=self.shell, stderr=subprocess.STDOUT, environ=self.env, cwd=self.cwd, bufsize=1) CommandStdoutReader(self, self.p.stdout).start() except Exception as ex: self.x = ex finally: self.rcode = self.p.wait() if self.p else False finally: gs.end(tid) self.ended = time.time() self.on_done(self) for f in self.done: try: f(self) except Exception: gs.notice(DOMAIN, gs.traceback())
def cb(res, err): if tid: gs.end(tid) res = gs.dval(res.get("Candidates"), []) calltip_cache.set(fn, src, pos, res, err) f(res, err)
def run(self): self.started = time.time() tid = gs.begin(DOMAIN, self.message, set_status=False, cancel=self.cancel) try: try: self.p = gs.popen( self.cmd, shell=self.shell, stderr=subprocess.STDOUT, environ=self.env, cwd=self.cwd, bufsize=1, ) CommandStdoutReader(self, self.p.stdout).start() except Exception as ex: self.x = ex finally: self.rcode = self.p.wait() if self.p else False finally: gs.end(tid) self.ended = time.time() self.on_done(self) for f in self.done: try: f(self) except Exception: gs.notice(DOMAIN, gs.traceback())
def run(self): tid = gs.begin(self.domain, self.msg, self.set_status) try: self.f() # WARN (CEV): Error except Exception: gs.notice(self.domain, gs.traceback()) finally: gs.end(tid)
def run(self): tid = gs.begin(self.domain, self.msg, self.set_status) try: self.f() except Exception: gs.notice(self.domain, gs.traceback()) finally: gs.end(tid)
def run(self): while True: try: f, msg, set_status = self.q.get() tid = gs.begin(self.domain, msg, set_status) try: f() except Exception: gs.notice(self.domain, gs.traceback()) except: pass gs.end(tid)
def _init_go_bin(): global GO_BIN if GO_BIN: return tid = gs.begin(DOMAIN, 'Looking for go') GO_BIN = gs.which('go') if not GO_BIN: _init_shell_path() GO_BIN = gs.which('go') gs.end(tid)
def do_post_save(view): if not gs.is_pkg_view(view): return for c in gs.setting('on_save', []): cmd = c.get('cmd', '') args = c.get('args', {}) msg = 'running on_save command %s' % cmd tid = gs.begin(DOMAIN, msg, set_status=False) try: view.run_command(cmd, args) except Exception as ex: gs.notice(DOMAIN, 'Error %s' % ex) finally: gs.end(tid)
def _init_go_version(): global GO_VERSION if GO_VERSION and GO_VERSION != about.DEFAULT_GO_VERSION: return tid = gs.begin(DOMAIN, 'Finding go version') bin = _go_bin() if bin: out, _, _ = gsshell.run(['go', 'version'], stderr=subprocess.STDOUT, env=gs.env()) m = about.GO_VERSION_OUTPUT_PAT.search(out) if m: GO_VERSION = '-'.join(s for s in m.groups() if s) gs.end(tid)
def calltip(fn, src, pos, quiet, f): tid = "" if not quiet: tid = gs.begin(DOMAIN, "Fetching calltips") def cb(res, err): if tid: gs.end(tid) res = gs.dval(res.get("Candidates"), []) calltip_cache.set(fn, src, pos, res, err) f(res, err) res, err, ok = calltip_cache.get(fn, src, pos) if ok: if tid: gs.end(tid) f(res, err) return return acall("gocode_calltip", _complete_opts(fn, src, pos, True), cb)
def f(): gs.end(tid) push_output(view, rkey, out, hourglass_repl='| done: %s' % res.get('dur', ''))
def cb(res, err): gs.end(tid) f(res, err)
def cb(res, err): if tid: gs.end(tid) res = gs.dval(res.get('Candidates'), []) f(res, err)
def cb(res, err): if tid: gs.end(tid) res = gs.dval(res.get('calltips'), []) f(res, err)
def f(): gs.end(tid) push_output(view, rkey, out, hourglass_repl="| done: %s" % res.get("dur", ""))