<#17946 Running pants help commands in Emacs with ...
# github-notifications
q
#17946 Running pants help commands in Emacs with pantsd enable causes errors Issue created by russell Describe the bug Running pants help commands in Emacs eshell with the daemon enabled results in an error. Using some debugging statements, I could determine the terminal width seems to me memorized as 0 in the pantsd process. But eshell was reporting the correct terminal width. When i run
Copy code
./pants help global
it results in
Copy code
21:26:23.81 [DEBUG] changed_options are: ChangedOptions(since=None, diffspec=None, dependees=<DependeesOption.NONE: 'none'>)
21:26:23.81 [DEBUG] Launching 1 roots (poll=false).
21:26:23.81 [DEBUG] computed 1 nodes in 0.002470 seconds. there are 17 total nodes.
21:26:23.84 [ERROR] invalid width -2 (must be > 0)
Traceback (most recent call last):
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/daemon_pants_runner.py", line 138, in single_daemonized_run
    return runner.run(start_time)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 269, in run
    engine_result = self._run_inner()
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 229, in _run_inner
    return self._run_builtin_goal(self.options.builtin_goal)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 219, in _run_builtin_goal
    return goal.run(
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/goal/help.py", line 53, in run
    return help_printer.print_help()
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_printer.py", line 60, in print_help
    return self._print_thing_help()
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_printer.py", line 202, in _print_thing_help
    help_table[thing](thing, help_request.advanced)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_printer.py", line 213, in _print_top_level_help
    self._print_options_help(GLOBAL_SCOPE, show_advanced)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_printer.py", line 388, in _print_options_help
    formatted_lines = help_formatter.format_options(oshi)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_formatter.py", line 52, in format_options
    add_option(oshi.basic)
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/help/help_formatter.py", line 40, in add_option
    lines.extend(hard_wrap(oshi.description, width=self._width))
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/util/strutil.py", line 158, in hard_wrap
    return [
  File "/home/russell/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/util/strutil.py", line 161, in <listcomp>
    for wrapped_line in textwrap.wrap(line, width=width - indent) or [line]
  File "/home/russell/.asdf/installs/python/3.9.5/lib/python3.9/textwrap.py", line 379, in wrap
    return w.wrap(text)
  File "/home/russell/.asdf/installs/python/3.9.5/lib/python3.9/textwrap.py", line 354, in wrap
    return self._wrap_chunks(chunks)
  File "/home/russell/.asdf/installs/python/3.9.5/lib/python3.9/textwrap.py", line 248, in _wrap_chunks
    raise ValueError("invalid width %r (must be > 0)" % self.width)
ValueError: invalid width -2 (must be > 0)
running the following command works and reports the correct terminal width
Copy code
$ python3 -c "import shutil; print(shutil.get_terminal_size().columns)"
134
if run without a daemon like this, then it works fine
Copy code
$ ./pants help global --no-pantsd
Pants version Which version of Pants are you using? 2.14.0 OS Are you encountering the bug on MacOS, Linux, or both? Linux pantsbuild/pants