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 <luca.fancellu@arm.com>
Loading
Please register or sign in to comment