|
@@ -1092,7 +1092,8 @@ G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads'))
|
|
|
G_STOP = thr.Event()
|
|
G_STOP = thr.Event()
|
|
|
|
|
|
|
|
class PlugError(Exception):
|
|
class PlugError(Exception):
|
|
|
- pass
|
|
|
|
|
|
|
+ def __init__(self, msg):
|
|
|
|
|
+ self.msg = msg
|
|
|
class CmdTimedOut(PlugError):
|
|
class CmdTimedOut(PlugError):
|
|
|
pass
|
|
pass
|
|
|
class CmdFailed(PlugError):
|
|
class CmdFailed(PlugError):
|
|
@@ -1166,7 +1167,8 @@ class Buffer(object):
|
|
|
class Command(object):
|
|
class Command(object):
|
|
|
def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None):
|
|
def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None):
|
|
|
self.cmd = cmd
|
|
self.cmd = cmd
|
|
|
- self.cmd_dir = cmd_dir
|
|
|
|
|
|
|
+ if cmd_dir:
|
|
|
|
|
+ self.cmd = 'cd {0} && {1}'.format(cmd_dir, self.cmd)
|
|
|
self.timeout = timeout
|
|
self.timeout = timeout
|
|
|
self.callback = cb if cb else (lambda msg: None)
|
|
self.callback = cb if cb else (lambda msg: None)
|
|
|
self.clean = clean if clean else (lambda: None)
|
|
self.clean = clean if clean else (lambda: None)
|
|
@@ -1216,7 +1218,7 @@ class Command(object):
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
tfile = tempfile.NamedTemporaryFile(mode='w+b')
|
|
tfile = tempfile.NamedTemporaryFile(mode='w+b')
|
|
|
- self.proc = subprocess.Popen(self.cmd, cwd=self.cmd_dir, stdout=tfile,
|
|
|
|
|
|
|
+ self.proc = subprocess.Popen(self.cmd, stdout=tfile,
|
|
|
stderr=subprocess.STDOUT, shell=True,
|
|
stderr=subprocess.STDOUT, shell=True,
|
|
|
preexec_fn=os.setsid)
|
|
preexec_fn=os.setsid)
|
|
|
thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,))
|
|
thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,))
|
|
@@ -1283,7 +1285,7 @@ class Plugin(object):
|
|
|
with self.lock:
|
|
with self.lock:
|
|
|
thread_vim_command("let s:update.new['{0}'] = 1".format(self.name))
|
|
thread_vim_command("let s:update.new['{0}'] = 1".format(self.name))
|
|
|
except PlugError as exc:
|
|
except PlugError as exc:
|
|
|
- self.write(Action.ERROR, self.name, [str(exc)])
|
|
|
|
|
|
|
+ self.write(Action.ERROR, self.name, exc.msg)
|
|
|
except KeyboardInterrupt:
|
|
except KeyboardInterrupt:
|
|
|
G_STOP.set()
|
|
G_STOP.set()
|
|
|
self.write(Action.ERROR, self.name, ['Interrupted!'])
|
|
self.write(Action.ERROR, self.name, ['Interrupted!'])
|