Pull requests / #3017

#3017 tests: test_winjob reads tasklist in the console's OEM code page (#2331)

open · @Buddychek · 0 comments · View on GitHub

Setup & installServer & APIAMD / HIPWindows

Description

## Title
tests: test_winjob reads tasklist in the console's OEM code page (#2331)

Issue: Resolves #2331

## Summary

`serve/test_winjob.py` asked `subprocess.run` to decode `tasklist` output as text with no encoding, which means the locale's preferred encoding - UTF-8 on the Python 3.15 default. `tasklist` writes in the console's OEM code page (cp850 on a Western European Windows), so its table frame bytes are not valid UTF-8: the reader thread raised, `stdout` came back `None`, and the PID membership check failed. The test is Windows-only, so this is a test-side fix only.

## What changed

- `serve/test_winjob.py` - the `tasklist` call passes `encoding="oem"`, `errors="replace"`, and the membership check tolerates a `None` stdout (`str(pid) in (out or "")`).

## Extra Notes

**Measured on this PC (Windows, Western European locale, cp850):**
- `serve/test_winjob.py`: 3/3 OK, including `test_children_end_with_a_killed_server`, which is the case that reads `tasklist`.
- Reproduced the failure mode before the fix: decoding the captured bytes as UTF-8 raises on the frame bytes, leaving `stdout` `None`.

**Not tested:** other locales' OEM pages. `encoding="oem"` resolves the active OEM page per process, which is what `tasklist` writes in; `errors="replace"` keeps a stray byte from killing the read.

No engine, server, or setup code is touched; the default path is byte-identical.

Related on this site

Quick links to related pages.