Merge pull request #345 from starcraftman/fix_msys

Merging fix for msys2.
This commit is contained in:
Jeremy Pallats/starcraft.man 2015-12-06 12:06:32 -05:00
commit 80e5b3eab5

View file

@ -1098,7 +1098,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):
@ -1172,7 +1173,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)
@ -1222,7 +1224,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,))
@ -1289,7 +1291,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!'])