Make postproc.py only leave fish prompt

Should fix fish tests
This commit is contained in:
ZyX 2014-01-23 07:36:54 +04:00
parent 166f827c9f
commit 2f98276ee0
3 changed files with 18 additions and 11 deletions

View File

@ -1,10 +1,8 @@
]0;source /home/USER/.vam/powerline-dev]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd .git   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
]0;cd /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd/.git⏎   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  
]0;cd /home/USER/.vam/powerline-dev/tests/shell/3rd/.git]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  set VIRTUAL_ENV "$HOME/.virtenvs/some-virtual-environment"   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
]0;set /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  set VIRTUAL_ENV   HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  
]0;set /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done" &   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
]0;bash /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  
]0;false /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill (cat pid) ; sleep 1s   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  
]0;kill /home/USER/.vam/powerline-dev/tests/shell/3rdfish: Job 1, “bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done" &” terminated by signal SIGTERM (Polite quit request)   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  false
]0;false /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎

View File

@ -12,6 +12,8 @@ fname = sys.argv[1]
new_fname = fname + '.new' new_fname = fname + '.new'
pid_fname = 'tests/shell/3rd/pid' pid_fname = 'tests/shell/3rd/pid'
shell = sys.argv[2]
with open(pid_fname, 'r') as P: with open(pid_fname, 'r') as P:
pid = P.read().strip() pid = P.read().strip()
hostname = socket.gethostname() hostname = socket.gethostname()
@ -32,6 +34,13 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
line = line.replace(hostname, 'HOSTNAME') line = line.replace(hostname, 'HOSTNAME')
line = line.replace(user, 'USER') line = line.replace(user, 'USER')
line = line.replace(pid, 'PID') line = line.replace(pid, 'PID')
if shell == 'fish':
try:
start = line.index('\033[0;')
end = line.index('\033[0m', start)
line = line[start : end+4] + '\n'
except ValueError:
line = ''
W.write(line) W.write(line)
os.rename(new_fname, fname) os.rename(new_fname, fname)

View File

@ -32,7 +32,7 @@ run_test() {
sleep 0.1s sleep 0.1s
done done
cp tests/shell/screen.log tests/shell/${SH}.full.log cp tests/shell/screen.log tests/shell/${SH}.full.log
./tests/test_shells/postproc.py tests/shell/screen.log ./tests/test_shells/postproc.py tests/shell/screen.log ${SH}
cp tests/shell/screen.log tests/shell/${SH}.log cp tests/shell/screen.log tests/shell/${SH}.log
if ! check_screen_log ${SH} ; then if ! check_screen_log ${SH} ; then
# Repeat the diff to make it better viewable in travis output # Repeat the diff to make it better viewable in travis output