Skip to content

Commit c813c85

Browse files
andyclaude
andcommitted
first-start: under pythonw keep errors in ~/.ECCE/first-start.log; ecce.cmd test prints it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFPK14wBcLD1s4dYUowpP4
1 parent b61078b commit c813c85

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎packaging/gateway/ecce-first-start‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ def tool(name):
5050

5151

5252
# pythonw has no standard streams, and its children need no console window.
53-
for _n in ("stdout", "stderr"):
54-
if getattr(sys, _n) is None:
55-
setattr(sys, _n, open(os.devnull, "w"))
53+
if sys.stdout is None:
54+
sys.stdout = open(os.devnull, "w")
55+
if sys.stderr is None:
56+
# What went wrong is then in ~/.ECCE/first-start.log.
57+
try:
58+
os.makedirs(STATE, exist_ok=True)
59+
sys.stderr = open(os.path.join(STATE, "first-start.log"), "a")
60+
except OSError:
61+
sys.stderr = open(os.devnull, "w")
5662

5763

5864
def run(cmd, timeout=30):

‎tests/windows/ecce_cmd_test.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ def run(name, answer, **extra):
8181
time.sleep(1)
8282
subprocess.run(["taskkill", "/F", "/IM", "organizer.exe"], capture_output=True)
8383
time.sleep(2)
84+
for f in (profile + "/.ECCE/first-start.log",):
85+
if os.path.exists(f):
86+
text += "\n" + f + ":\n" + open(f, errors="replace").read()
87+
text += "\nsiteconfig: %s\n" % sorted(os.listdir(os.path.join(root, "siteconfig")))
8488
print("%s: rc=%d organizer=%s\n%s" % (name, rc, up, text))
8589
return rc, profile, up
8690

0 commit comments

Comments
 (0)