quaint-telephone-89068
02/17/2023, 1:22 AMpants --loop ... command requires running a shell_command or adhoc_tool, and that runnable fails (exit code != 0), it'll be immediately rerun, and do this forever. The most direct example is pants --loop export-codegen path/to:target but I think it occurs just as well for something like pants --loop test path/to:tests if the tests depend on such a target.
Reproducer for `shell_command`/`experimental_shell_command`, but `adhoc_tool`/`experimental_run_in_sandbox` is similar (note using 2.16.0.dev6 so uses the old esc name)
cd $(mktemp -d)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.16.0.dev6"
backend_packages = [
"pants.backend.shell",
]
[anonymous-telemetry]
enabled = false
EOF
cat > BUILD <<EOF
experimental_shell_command(name="esc_success", command="true", tools=[])
experimental_shell_command(name="esc_failure", command="false", tools=[])
EOF
pants --loop export-codegen :esc_success
#> 12:18:31.49 [INFO] Writing generated files to dist/codegen
# (then waits for changes)
# BUG:
pants --loop export-codegen :esc_failure
# (output below)
...
12:20:27.36 [INFO] Completed: Running the `experimental_shell_command` at `//:esc_failure`
12:20:27.36 [ERROR] 1 Exception encountered:
Engine traceback:
in `export-codegen` goal
ProcessExecutionFailure: Process 'the `experimental_shell_command` at `//:esc_failure`' failed with exit code 1.
stdout:
stderr:
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
12:20:27.37 [INFO] Completed: Running the `experimental_shell_command` at `//:esc_failure`
12:20:27.37 [ERROR] 1 Exception encountered:
Engine traceback:
in `export-codegen` goal
ProcessExecutionFailure: Process 'the `experimental_shell_command` at `//:esc_failure`' failed with exit code 1.
stdout:
stderr:
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
12:20:27.38 [INFO] Completed: Running the `experimental_shell_command` at `//:esc_failure`
12:20:27.38 [ERROR] 1 Exception encountered:
Engine traceback:
in `export-codegen` goal
ProcessExecutionFailure: Process 'the `experimental_shell_command` at `//:esc_failure`' failed with exit code 1.
stdout:
stderr:
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
...
Note the timestamps: it's really hammering on this esc 😅
Pants version
2.16.0.dev6
OS
macOS
Additional info
This is similar to #16727. Other infinite --loop bugs: #18276, #18277.
pantsbuild/pantsuser
02/21/2023, 9:52 PMuser
02/21/2023, 10:43 PM