mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 00:22:10 -04:00
chore: use explicit utf-8 for shell job files (#820)
This commit is contained in:
@@ -469,7 +469,8 @@ async def _generate_tmux(cmd: str, request: Request):
|
|||||||
f"EC=${{PIPESTATUS[0]}}\n"
|
f"EC=${{PIPESTATUS[0]}}\n"
|
||||||
f"echo ':::EXIT_CODE:::'$EC >> '{log_path}'\n"
|
f"echo ':::EXIT_CODE:::'$EC >> '{log_path}'\n"
|
||||||
f"rm -f '{script_path}'\n"
|
f"rm -f '{script_path}'\n"
|
||||||
f"exit $EC\n"
|
f"exit $EC\n",
|
||||||
|
encoding="utf-8",
|
||||||
)
|
)
|
||||||
script_path.chmod(0o755)
|
script_path.chmod(0o755)
|
||||||
logger.info("tmux wrapper script created: session=%s path=%s", session_id, script_path)
|
logger.info("tmux wrapper script created: session=%s path=%s", session_id, script_path)
|
||||||
@@ -504,7 +505,7 @@ async def _generate_tmux(cmd: str, request: Request):
|
|||||||
# Read new lines from log
|
# Read new lines from log
|
||||||
try:
|
try:
|
||||||
if log_path.exists():
|
if log_path.exists():
|
||||||
lines = log_path.read_text(errors="replace").splitlines()
|
lines = log_path.read_text(encoding="utf-8", errors="replace").splitlines()
|
||||||
new_lines = lines[lines_sent:]
|
new_lines = lines[lines_sent:]
|
||||||
for line in new_lines:
|
for line in new_lines:
|
||||||
if line.startswith(":::EXIT_CODE:::"):
|
if line.startswith(":::EXIT_CODE:::"):
|
||||||
@@ -532,7 +533,7 @@ async def _generate_tmux(cmd: str, request: Request):
|
|||||||
# Session ended — do one final read
|
# Session ended — do one final read
|
||||||
await asyncio.sleep(0.5)
|
await asyncio.sleep(0.5)
|
||||||
if log_path.exists():
|
if log_path.exists():
|
||||||
lines = log_path.read_text(errors="replace").splitlines()
|
lines = log_path.read_text(encoding="utf-8", errors="replace").splitlines()
|
||||||
for line in lines[lines_sent:]:
|
for line in lines[lines_sent:]:
|
||||||
if line.startswith(":::EXIT_CODE:::"):
|
if line.startswith(":::EXIT_CODE:::"):
|
||||||
try:
|
try:
|
||||||
|
|||||||
+1
-1
@@ -195,7 +195,7 @@ def refresh() -> Dict[str, Dict[str, Any]]:
|
|||||||
exit_path = Path(rec.get("exit_path", ""))
|
exit_path = Path(rec.get("exit_path", ""))
|
||||||
if exit_path.exists():
|
if exit_path.exists():
|
||||||
try:
|
try:
|
||||||
code = int(exit_path.read_text().strip() or "1")
|
code = int(exit_path.read_text(encoding="utf-8", errors="replace").strip() or "1")
|
||||||
except Exception:
|
except Exception:
|
||||||
code = 1
|
code = 1
|
||||||
rec["exit_code"] = code
|
rec["exit_code"] = code
|
||||||
|
|||||||
Reference in New Issue
Block a user