mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 14:39:58 -04:00
Keep reading the build's output when a handler fails.
build.Run read the build's output on a thread that ended on the first exception of a line or event handler, such as the launcher's log on a full disk. Nobody read the pipe after that, the build stopped at its next line once the pipe was full, and the job waited for it for good. The thread now counts the line as dropped and reads on, and Context.log loses a line it cannot write instead of raising. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -34,12 +34,18 @@ class Context:
|
||||
'it was is kept as launcher.json.bad')
|
||||
|
||||
def log(self, line):
|
||||
"""One line (or several) into launcher.log. A log that cannot be written (a full disk, a file closed under
|
||||
it) loses the line and nothing else: the callers log from the build's reader thread and from the window's
|
||||
timers, where an exception would stop the build's output from being read or the timer from running."""
|
||||
stamp = time.strftime('%H:%M:%S')
|
||||
with self._lock:
|
||||
if self._file:
|
||||
for part in str(line).splitlines() or ['']:
|
||||
self._file.write(f'{stamp} {part}\n')
|
||||
self._file.flush()
|
||||
try:
|
||||
for part in str(line).splitlines() or ['']:
|
||||
self._file.write(f'{stamp} {part}\n')
|
||||
self._file.flush()
|
||||
except (OSError, ValueError): # ValueError: the file was closed
|
||||
pass
|
||||
if self.echo:
|
||||
print(line, flush=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user