mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-06-02 06:14:48 +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
|
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(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="[%(asctime)s] %(levelname)s %(name)s: %(message)s",
|
format="[%(asctime)s] %(levelname)s %(name)s: %(message)s",
|
||||||
|
|||||||
@@ -334,6 +334,11 @@ export class PythonRPC {
|
|||||||
const childProcess = cp.spawn(binaryPath, commonArgs, {
|
const childProcess = cp.spawn(binaryPath, commonArgs, {
|
||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
stdio: ["pipe", "pipe", "pipe"],
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
PYTHONIOENCODING: "utf-8",
|
||||||
|
PYTHONUTF8: "1",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
this.logStderr(childProcess.stderr);
|
this.logStderr(childProcess.stderr);
|
||||||
@@ -355,6 +360,11 @@ export class PythonRPC {
|
|||||||
[scriptPath, ...commonArgs],
|
[scriptPath, ...commonArgs],
|
||||||
{
|
{
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
stdio: ["pipe", "pipe", "pipe"],
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
PYTHONIOENCODING: "utf-8",
|
||||||
|
PYTHONUTF8: "1",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user