mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-06-01 22:09:27 +02:00
chore: update Python RPC environment settings for UTF-8 encoding and adjust logging configuration (#2219)
This commit is contained in:
@@ -13,6 +13,14 @@ import libtorrent as lt
|
||||
|
||||
from torrent_downloader import TorrentDownloader
|
||||
|
||||
for _stream in (sys.stdin, sys.stdout, sys.stderr):
|
||||
reconfigure = getattr(_stream, "reconfigure", None)
|
||||
if callable(reconfigure):
|
||||
try:
|
||||
reconfigure(encoding="utf-8", errors="strict")
|
||||
except (ValueError, OSError):
|
||||
pass
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="[%(asctime)s] %(levelname)s %(name)s: %(message)s",
|
||||
|
||||
@@ -334,6 +334,11 @@ export class PythonRPC {
|
||||
const childProcess = cp.spawn(binaryPath, commonArgs, {
|
||||
windowsHide: true,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
env: {
|
||||
...process.env,
|
||||
PYTHONIOENCODING: "utf-8",
|
||||
PYTHONUTF8: "1",
|
||||
},
|
||||
});
|
||||
|
||||
this.logStderr(childProcess.stderr);
|
||||
@@ -355,6 +360,11 @@ export class PythonRPC {
|
||||
[scriptPath, ...commonArgs],
|
||||
{
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
env: {
|
||||
...process.env,
|
||||
PYTHONIOENCODING: "utf-8",
|
||||
PYTHONUTF8: "1",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user