Commit 678478b
committed
Make the shell command safer in at least two ways
Prevent errors where we could not retrieve the command status like
File "/usr/lib/python3.13/site-packages/avocado_spawner_remote/__init__.py", line 218, in wait_task
if not RemoteSpawner.is_task_alive(runtime_task):
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/avocado_spawner_remote/__init__.py", line 142, in is_task_alive
status, output = session.cmd_status_output(
~~~~~~~~~~~~~~~~~~~~~~~~~^
f"pgrep -r R,S -f {runtime_task.task.identifier}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3.13/site-packages/aexpect/client.py", line 1491, in cmd_status_output
raise ShellStatusError(cmd, out) from error
Use the "safe" flag to handle cases where the shell prompt might be
polluted with "[Done] some-background-process" appearing from the
detached avocado task process but also handle any further unexpected
status retrieval errors. There were still rare cases where the safe
flag might miss something yet it does filter our most cases from
needing to catch status errors (which is also worst in terms of
peformance compared to a regular boolean check).
Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>1 parent 22d58b8 commit 678478b
1 file changed
Lines changed: 3 additions & 1 deletion
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
0 commit comments