def hello(): def cb(): global hello_sarting if hello_sarting: return hello_sarting = True print 'starting gocode' call_cmd(['gocode']) margo_cmd = list(gs.setting('margo_cmd', [])) if not margo_cmd: err = 'Missing `margo_cmd`' gs.notice("MarGo", err) hello_sarting = False return margo_cmd.extend([ "-d", "-call", "replace", "-addr", gs.setting('margo_addr', '') ]) print 'starting margo' out, err, _ = gs.runcmd(margo_cmd) out = out.strip() err = err.strip() if err: gs.notice(DOMAIN, err) elif out: gs.notice(DOMAIN, 'MarGo started %s' % out) hello_sarting = False _, err = margo.post('/', 'hello', {}, True) if err: dispatch(cb, 'Starting MarGo and gocode...') else: call_cmd(['gocode'])
def hello(): _, err = margo.post('/', 'hello', {}, True, False) if err: dispatch(do_hello, 'Starting MarGo and gocode...')
def hello(): _, err = margo.post('/', 'hello', {}, True, False) if err: dispatch(do_hello, 'Starting MarGo and gocode...') else: call_cmd([mg9.GOCODE_BIN])