Skip to content

Commit ec3dd02

Browse files
author
Vladimir Kotal
committed
handle exceptions when printing in OutputThread
fixes #2926
1 parent 14a8a10 commit ec3dd02

File tree

1 file changed

+6
-1
lines changed
  • opengrok-tools/src/main/python/opengrok_tools/utils

1 file changed

+6
-1
lines changed

opengrok-tools/src/main/python/opengrok_tools/utils/command.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ def run(self):
177177
self.out.append(line)
178178

179179
if self.doprint:
180-
print(line.rstrip())
180+
# Even if print() fails the thread has to keep
181+
# running to avoid hangups of the executed command.
182+
try:
183+
print(line.rstrip())
184+
except Exception as print_exc:
185+
self.logger.error(print_exc)
181186

182187
def getoutput(self):
183188
return self.out

0 commit comments

Comments
 (0)