On Windows, calling LocalKaos.exec() to spawn a subprocess (e.g. PowerShell) with redirected stdin/stdout/stderr pipes causes the parent cmd.exe console's TrueType font (specifically Consolas) to be silently reset to a raster/legacy font. After this, all non-ASCII characters (Cyrillic, emoji, etc.) become invisible. The code page remains UTF-8 (chcp 65001), so the issue is purely the console font being mutated.
Other TrueType fonts (Ubuntu Mono, Iosevka) are unaffected; only Consolis is reset.
Reproduction
- Open cmd.exe on Windows 10/11.
- chcp 65001
- Set console font to Consolas (Properties → Font).
- Run a script that calls kaos.local.LocalKaos.exec("powershell", "-command", "echo test").
- After the subprocess exits, type Cyrillic text in the console — characters are invisible/blank.
Root cause
asyncio.create_subprocess_exec() is called without creationflags. On Windows, the child process inherits a console handle, which triggers the OS to re-evaluate the parent console font and fall back to a raster font.
Proposed fix
Pass subprocess.CREATE_NO_WINDOW on Windows to detach the child from the parent console host:
async def exec(self, *args: str, env: Mapping[str, str] | None = None) -> KaosProcess:
if not args:
raise ValueError("At least one argument (the program to execute) is required.")
import subprocess
creationflags = 0
if os.name == "nt":
creationflags = subprocess.CREATE_NO_WINDOW
process = await asyncio.create_subprocess_exec(
*args,
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
env=env,
creationflags=creationflags,
)
return self.Process(process)
This change prevents the font reset while keeping all existing functionality intact.
On Windows, calling LocalKaos.exec() to spawn a subprocess (e.g. PowerShell) with redirected stdin/stdout/stderr pipes causes the parent cmd.exe console's TrueType font (specifically Consolas) to be silently reset to a raster/legacy font. After this, all non-ASCII characters (Cyrillic, emoji, etc.) become invisible. The code page remains UTF-8 (chcp 65001), so the issue is purely the console font being mutated.
Other TrueType fonts (Ubuntu Mono, Iosevka) are unaffected; only Consolis is reset.
Reproduction
Root cause
asyncio.create_subprocess_exec() is called without creationflags. On Windows, the child process inherits a console handle, which triggers the OS to re-evaluate the parent console font and fall back to a raster font.
Proposed fix
Pass subprocess.CREATE_NO_WINDOW on Windows to detach the child from the parent console host:
This change prevents the font reset while keeping all existing functionality intact.