Skip to content

Conversation

@ko1in1u
Copy link
Collaborator

@ko1in1u ko1in1u commented Aug 20, 2025

This refactors run_command to use subprocess.Popen.communicate(timeout=...) for a more robust timeout mechanism.

The old method, relying on a custom threading.Timer, could fail to terminate stubborn processes like fastboot oem dmesg which ignore SIGTERM. The new approach uses communicate(), which sends a forceful SIGKILL on timeout, guaranteeing the process is terminated.

This change also updates the code to use the modern text argument introduced in Python 3.7 to replace universal_newlines.

@ko1in1u ko1in1u added this to the Mobly Release 1.13.1 milestone Aug 20, 2025
@ko1in1u ko1in1u requested review from mhaoli and xianyuanjia August 20, 2025 21:24
@ko1in1u ko1in1u self-assigned this Aug 20, 2025
@ko1in1u ko1in1u added the bug label Aug 20, 2025
xianyuanjia
xianyuanjia previously approved these changes Aug 20, 2025
@ko1in1u ko1in1u requested a review from xpconanfan September 4, 2025 19:37
mhaoli
mhaoli previously approved these changes Sep 5, 2025
This refactors `run_command` to use `subprocess.Popen.communicate(timeout=...)` for a more robust timeout mechanism.

The old method, relying on a custom `threading.Timer`, could fail to terminate stubborn processes like `fastboot oem dmesg` which ignore `SIGTERM`. The new approach uses `communicate()`, which sends a forceful `SIGKILL` on timeout, guaranteeing the process is terminated.

This change also updates the code to use the modern `text` argument introduced in Python 3.7 to replace `universal_newlines`.
@ko1in1u
Copy link
Collaborator Author

ko1in1u commented Dec 16, 2025

Sync to the head and pass internal TAP train, please help to review again.

@ko1in1u ko1in1u dismissed stale reviews from mhaoli and xianyuanjia via ea21087 December 16, 2025 06:51
@ko1in1u ko1in1u merged commit 5523cb5 into google:master Dec 22, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants