Exemple #1
0
def do_hello():
	global hello_sarting
	if hello_sarting:
		return
	hello_sarting = True

	tid = gs.begin(DOMAIN, 'Starting Gocode', False)
	call_cmd(['gocode'])
	gs.end(tid)

	margo_cmd = list(gs.setting('margo_cmd', []))
	if margo_cmd:
		margo_cmd.extend([
			"-d",
			"-call", "replace",
			"-addr", gs.setting('margo_addr', '')
		])

		tid = gs.begin(DOMAIN, 'Starting MarGo', False)
		out, err, _ = gs.runcmd(margo_cmd)
		gs.end(tid)

		out = out.strip()
		err = err.strip()
		if err:
			gs.notice(DOMAIN, err)
		elif out:
			gs.notice(DOMAIN, 'MarGo started %s' % out)
		hello_sarting = False
	else:
		err = 'Missing `margo_cmd`'
		gs.notice("MarGo", err)
		hello_sarting = False
Exemple #2
0
    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 do_hello():
	global hello_sarting
	if hello_sarting:
		return
	hello_sarting = True

	tid = gs.begin(DOMAIN, 'Starting Gocode', False)
	call_cmd([mg9.GOCODE_BIN])
	gs.end(tid)

	margo_cmd = list(gs.setting('margo_cmd', []))
	margo_cmd = [
		mg9.MARGO0_BIN,
		"-d",
		"-call", "replace",
		"-addr", gs.setting('margo_addr', '')
	]

	tid = gs.begin(DOMAIN, 'Starting MarGo', False)
	out, err, _ = gs.runcmd(margo_cmd)
	gs.end(tid)

	out = out.strip()
	err = err.strip()
	if err:
		gs.notice(DOMAIN, err)
	elif out:
		gs.println(DOMAIN, 'MarGo started %s' % out)
	hello_sarting = False
Exemple #4
0
 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)
Exemple #5
0
 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)
Exemple #6
0
	def run(self):
		while True:
			try:
				f, msg = self.q.get()
				tid = gs.begin(self.domain, msg, False)

				try:
					f()
				except Exception:
					gs.notice(self.domain, traceback.format_exc())
			except:
				pass

			gs.end(tid)
Exemple #7
0
    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)
Exemple #8
0
    def run(self):
        while True:
            try:
                f, msg = self.q.get()
                tid = gs.begin(self.domain, msg, False)

                try:
                    f()
                except Exception:
                    gs.notice(self.domain, traceback.format_exc())
            except:
                pass

            gs.end(tid)
Exemple #9
0
    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)
Exemple #10
0
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 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)
Exemple #12
0
def do_post_save(view):
	if not gs.is_pkg_view(view):
		return

	domain = 'GoSublime-On-Save'
	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)
		gs.println(msg)
		try:
			view.run_command(cmd, args)
		except Exception as ex:
			gs.notice(domain, 'Error %s' % ex)
		finally:
			gs.end(tid)
Exemple #13
0
def do_post_save(view):
    if not gs.is_pkg_view(view):
        return

    domain = 'GoSublime-On-Save'
    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)
        gs.println(msg)
        try:
            view.run_command(cmd, args)
        except Exception as ex:
            gs.notice(domain, 'Error %s' % ex)
        finally:
            gs.end(tid)
def do_hello():
    global hello_sarting
    if hello_sarting:
        return
    hello_sarting = True

    margo_cmd = [
        mg9.MARGO0_BIN, "-d", "-call", "replace", "-addr",
        gs.setting('margo_addr', '')
    ]

    tid = gs.begin(DOMAIN, 'Starting MarGo', False)
    out, err, _ = gsshell.run(margo_cmd)
    gs.end(tid)

    out = out.strip()
    err = err.strip()
    if err:
        gs.notice(DOMAIN, err)
    elif out:
        gs.println(DOMAIN, 'MarGo started %s' % out)
    hello_sarting = False
Exemple #15
0
	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())
Exemple #16
0
			def f():
				gs.end(tid)
				view.insert(edit, r.end(), '\n%s' % out)
				view.run_command('gs_commander_init')
Exemple #17
0
 def f():
     gs.end(tid)
     push_output(view,
                 rkey,
                 out,
                 hourglass_repl='| done: %s' % res.get('dur', ''))
Exemple #18
0
		def f():
			gs.end(tid)
			push_output(view, rkey, out, hourglass_repl='| done: %s' % res.get('dur', ''))
Exemple #19
0
	def cb(res, err):
		gs.end(tid)
		f(res, err)
 def cb(res, err):
     gs.end(tid)
     f(res, err)