<#16727 `./pants --loop ...` with failing command ...
# github-notifications
q
#16727 `./pants --loop ...` with failing command continuously reruns, forever Issue created by huonw Describe the bug When running
./pants --loop ...
with a command that has an error, pants will run and rerun the command forever. Examples of failing commands: •
./pants --loop fmt ::
with black configured when there's a Python source file with invalid syntax (spelled out below) • any pants command that needs to run a `shell_command`/`adhoc_tool` with exit code != 0 #18275 • running any goal on a target that doesn't exist #18276 • running any goal when a BUILD file is invalid #18277 Reproducer of the
black
example (see linked issues for other simpler reproducers): https://gist.github.com/huonw/55bf0340a467881dc8511346f5ad2d5a has a single bad file
broken.py
. Running:
Copy code
git clone <mailto:git@gist.github.com|git@gist.github.com>:55bf0340a467881dc8511346f5ad2d5a.git
cd 55bf0340a467881dc8511346f5ad2d5a
./pants --loop fmt ::
This gives endless copies of the black error message:
Copy code
09:17:34.49 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Run Black on 1 file.' failed with exit code 123.
stdout:

stderr:
error: cannot format broken.py: Cannot parse: 1:8: invalid formatting

Oh no! šŸ’„ šŸ’” šŸ’„
1 file failed to reformat.



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
Copy code
09:17:34.59 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Run Black on 1 file.' failed with exit code 123.
stdout:

stderr:
error: cannot format broken.py: Cannot parse: 1:8: invalid formatting

Oh no! šŸ’„ šŸ’” šŸ’„
1 file failed to reformat.



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
etc. Pants version • 2.12.0 • 2.14.0a0 • 2.16.0.dev6 OS macOS Additional info N/A pantsbuild/pants