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

pantsbuild / pants / 26613861926
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:18AM UTC
Jobs 12
Files 1737
Run time 3min
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: 92.891% (-0.001%) from 92.892%
26613861926

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>

9 of 9 new or added lines in 2 files covered. (100.0%)

1 existing line in 1 file now uncovered.

92120 of 99170 relevant lines covered (92.89%)

4.04 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
96.15
-3.85% src/python/pants/backend/tools/preamble/subsystem.py
Jobs
ID Job ID Ran Files Coverage
1 test_python_linux_x86_64_5/10 - 26613861926.1 29 May 2026 02:21AM UTC 1206
59.64
GitHub Action Run
2 test_python_macos14_arm64 - 26613861926.2 29 May 2026 02:18AM UTC 1175
52.31
GitHub Action Run
3 test_python_linux_x86_64_3/10 - 26613861926.3 29 May 2026 02:20AM UTC 1191
53.96
GitHub Action Run
4 test_python_linux_arm64 - 26613861926.4 29 May 2026 02:19AM UTC 1175
52.3
GitHub Action Run
5 test_python_linux_x86_64_9/10 - 26613861926.5 29 May 2026 02:20AM UTC 1202
54.07
GitHub Action Run
6 test_python_linux_x86_64_6/10 - 26613861926.6 29 May 2026 02:19AM UTC 1187
49.53
GitHub Action Run
7 test_python_linux_x86_64_4/10 - 26613861926.7 29 May 2026 02:20AM UTC 1226
59.45
GitHub Action Run
8 test_python_linux_x86_64_2/10 - 26613861926.8 29 May 2026 02:20AM UTC 1194
58.62
GitHub Action Run
9 test_python_linux_x86_64_1/10 - 26613861926.9 29 May 2026 02:20AM UTC 1190
49.16
GitHub Action Run
10 test_python_linux_x86_64_7/10 - 26613861926.10 29 May 2026 02:20AM UTC 1197
51.3
GitHub Action Run
11 test_python_linux_x86_64_0/10 - 26613861926.11 29 May 2026 02:20AM UTC 1211
56.71
GitHub Action Run
12 test_python_linux_x86_64_8/10 - 26613861926.12 29 May 2026 02:20AM UTC 1194
53.57
GitHub Action Run
Source Files on build 26613861926
  • Tree
  • List 1737
  • Changed 3
  • Source Changed 2
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26613861926
  • 043451a5 on github
  • Prev Build on 2.32.x (#26547580570)
  • Next Build on 2.32.x (#26615999842)
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