Skip to content

Commit a71ea61

Browse files
committed
use textwrap.shorten()
1 parent 41b2c23 commit a71ea61

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import os
2626
import signal
2727
import subprocess
28+
import textwrap
2829
import threading
2930
import time
3031

@@ -211,7 +212,7 @@ def run(self):
211212

212213
# Assuming that self.max_line_length is bigger than 3.
213214
if self.max_line_length > 0 and len(line) > self.max_line_length:
214-
line = line[:self.max_line_length] + "..."
215+
line = textwrap.shorten(line, width=self.max_line_length, placeholder="...")
215216

216217
# Shorten the list to be one less than the maximum because a line is going to be added.
217218
if self.max_lines > 0 and len(self.out) >= self.max_lines:

0 commit comments

Comments
 (0)