• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 26613861926 / 7
93%
main: 93%

Build:
Build:
LAST BUILD BRANCH: fix/rust-dockerfile-parser-fails-on-base-image-with-hash-build-arg
DEFAULT BRANCH: main
Ran 29 May 2026 02:21AM UTC
Files 1226
Run time 34s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 May 2026 02:12AM UTC coverage: 59.453% (-0.003%) from 59.456%
26613861926.7

push

github

web-flow
fix: fallback to default width when terminal size is 0 (Cherry-pick of #23364) (#23385)

Resolves #17946

# Problem Description
The bug occurred specifically when running help commands (pants help)
within the Emacs editor's eshell terminal. Because it is a more limited
environment, eshell incorrectly reported the terminal width as 0
columns.

The function responsible for calculating this width (terminal_width),
located in the docutil.py file, used the shutil.get_terminal_size()
method to capture the value. Upon receiving the value 0, the function
simply subtracted a standard padding of 2. This mathematical calculation
resulted in a negative width of -2. Consequently, when the system
attempted to format the help text to fit on an impossible -2 column
screen, the program suffered a total collapse, triggering the fatal
error ValueError: invalid width -2 (must be > 0).


# What changed:
Refactored terminal_width in docutil.py to explicitly check if
shutil.get_terminal_size().columns returns 0.

If columns == 0 (which happens in limited terminals like Emacs eshell),
the function now applies the default fallback value before subtracting
the padding, preventing a ValueError with negative widths.

Added a regression test
(test_terminal_width_falls_back_when_columns_are_zero) in
docutil_test.py to ensure the fallback logic holds via monkeypatching.

Co-authored-by: Thiago Riemma Carbonera <132521983+thiago-carbonera@users.noreply.github.com>

38184 of 64225 relevant lines covered (59.45%)

0.59 hits per line

Source Files on job test_python_linux_x86_64_4/10 - 26613861926.7
  • Tree
  • List 1226
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 26613861926
  • 043451a5 on github
  • Prev Job for on 2.32.x (#26547580570.5)
  • Next Job for on 2.32.x (#26615999842.12)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc