Ignore some tmux failures

Fixes #1354
This commit is contained in:
Foo 2015-05-09 00:13:44 +03:00
parent 034b7d529d
commit 9f7e59d0cf
2 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct
import os
import re
import sys
import subprocess
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
@ -75,7 +76,12 @@ def source_tmux_files(pl, args):
cmd = deduce_command()
if cmd:
set_tmux_environment('POWERLINE_COMMAND', deduce_command(), remove=False)
try:
run_tmux_command('refresh-client')
except subprocess.CalledProcessError:
# On tmux-2.0 this command may fail for whatever reason. Since it is
# critical just ignore the failure.
pass
class EmptyArgs(object):

View File

@ -50,7 +50,12 @@ def set_tmux_environment(varname, value, remove=True):
'''
run_tmux_command('set-environment', '-g', varname, value)
if remove:
try:
run_tmux_command('set-environment', '-r', varname)
except subprocess.CalledProcessError:
# On tmux-2.0 this command may fail for whatever reason. Since it is
# critical just ignore the failure.
pass
NON_DIGITS = re.compile('[^0-9]+')