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

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

Build:
Build:
LAST BUILD BRANCH: perf/parse-build-files-once
DEFAULT BRANCH: main
Ran 29 May 2026 02:21AM UTC
Files 1175
Run time 27s
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: 52.307% (-0.002%) from 52.309%
26613861926.2

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>

31805 of 60805 relevant lines covered (52.31%)

0.52 hits per line

Source Files on job test_python_macos14_arm64 - 26613861926.2
  • Tree
  • List 1175
  • 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.6)
  • 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