Skip to content
Commit 0595e101 authored by Luca Fancellu's avatar Luca Fancellu
Browse files

yocto/oeqa: Improve LinuxBackgroundRun __exit__ function



If an exception is thrown inside the 'with' context, the
__exit__ method will be called and the code inside it will
return False to re-raise the exception at the end of the
__exit__ function, but before that, the kill() method will
be called and some command will be sent to the console.

However in the case of an exception for timeout, for example
a command that runs indefinitely for any reason, the underlying
console is still busy with the overrun command and any subsequent
commands issued by the kill() function won't be executed.

To prevent this case, rework the __exit__ function to send a
signal through ctrl-C and try to stop the command running, wait
for the prompt to be available and only at this point start the
procedure to stop the background process.
Create a new helper function in LinuxTermUtils to stop the running
command and wait for the prompt.

Signed-off-by: Luca Fancellu's avatarLuca Fancellu <luca.fancellu@arm.com>
parent 659cfba8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment