Fix StatefulConnection to not to fail on exit

Some of the images require `tail` process to be explicitly stopped
after the `tail -f ... | nc ...` command has been executed and `nc`
process is finished. But most of the time `tail` process is ended
automatically that leads to fail of `killall tail` command.

Change-Id: I43c0b7781ca2ed98156e125566115196aab530cf
This commit is contained in:
Alex Katz 2021-08-03 10:21:43 +03:00
parent 0e98f828ab
commit 5d1043b27a
1 changed files with 4 additions and 2 deletions

View File

@ -204,6 +204,8 @@ class StatefulConnection:
def __exit__(self, type, value, traceback):
self.server_ssh.exec_command('sudo killall nc || killall nc')
self.server_ssh.exec_command('sudo killall tail || killall tail')
self.server_ssh.exec_command(
'sudo killall tail || killall tail || echo "True"')
self.client_ssh.exec_command('sudo killall nc || killall nc')
self.client_ssh.exec_command('sudo killall tail || killall tail')
self.client_ssh.exec_command(
'sudo killall tail || killall tail || echo "True"')