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
]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 ..
]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"
]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
]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" &
]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
]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
]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)
]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⏎
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  

View File

@ -12,6 +12,8 @@ fname = sys.argv[1]
new_fname = fname + '.new'
pid_fname = 'tests/shell/3rd/pid'
shell = sys.argv[2]
with open(pid_fname, 'r') as P:
pid = P.read().strip()
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(user, 'USER')
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)
os.rename(new_fname, fname)

View File

@ -32,7 +32,7 @@ run_test() {
sleep 0.1s
done
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
if ! check_screen_log ${SH} ; then
# Repeat the diff to make it better viewable in travis output