pantsbuild / scie-pants

Protects your Pants from the elements.
https://www.pantsbuild.org/docs/installation
Apache License 2.0
19 stars 18 forks source link

Set a friendlier `PANTS_BIN_NAME` #111

Closed jsirois closed 1 year ago

jsirois commented 1 year ago

Currently the absolute path of scie-pants is used. This is correct, but in the common case its verbose and not what the user actually typed. Worse, Pants uses this value in ways it probably should not and gets absolute paths written into files where they do not belong.

See https://github.com/pantsbuild/pants/issues/18202, but the idea is to just use the basename of scie-pants if it is on the PATH and otherwise relativize it if it is within the BUILDROOT tree finally falling back to the current absolute path in all other cases.

jsirois commented 1 year ago

The above prescription was much more complex than need be. The argv0 reflects exactly what the user typed; so it's more robust, faster and of perfect fidelity.