Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the experimental_run_shell_command example. #16286

Merged

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Jul 23, 2022

  1. The double-braces are incorrect, should be single braces
    (perhaps this used to be used as input for interplation?)
  2. Use find instead of tree as many systems do not have the
    latter by default.

Note thattestprojects/ is intended to be a home for inputs to
integration tests. So possibly we should either write a test that
uses this example, or remove it.

[ci skip-rust]

[ci skip-build-wheels]

1) The double-braces are incorrect, should be single braces
   (perhaps this used to be used as input for interplation?)
2) Use `find` instead of `tree` as many systems do not have the
   latter by default.

Note that we may also want to remove this example entirely,
as `testprojects/` is intended to be a home for inputs to
integration tests.  So either we should either write a test that
uses this, or remove it.

[ci skip-rust]

[ci skip-build-wheels]
@benjyw benjyw requested a review from kaos July 23, 2022 19:51
Copy link
Member

@kaos kaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just dropping the extra brace leaves the chroot placeholder hanging, no?

@@ -21,6 +21,6 @@ files(name="sources_directory", sources=["sources/**/*"])

experimental_run_shell_command(
name="cmd",
command='{{ tree {chroot}; echo "in: $CHROOT"; }} | tee output.log',
command='{ find {chroot} -type f; echo "in: $CHROOT"; } | tee output.log',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not going through formatting, then the {chroot} part is hardly correct either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All I know is, it works (on macos and linux) without the double braces and does not work with them.

Copy link
Contributor Author

@benjyw benjyw Jul 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we use string replace to replace {chroot} with the chroot path, not a call to format():

*value = value.replace("{chroot}", chroot_path);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oohh... that would explain it.

@benjyw benjyw merged commit d12a771 into pantsbuild:main Jul 27, 2022
@benjyw benjyw deleted the fix_experimental_run_shell_cmd_example branch July 27, 2022 19:30
cczona pushed a commit to cczona/pants that referenced this pull request Sep 1, 2022
1) The double-braces are incorrect, should be single braces
   (perhaps this used to be used as input for interplation?)
2) Use `find` instead of `tree` as many systems do not have the
   latter by default.

Note that we may also want to remove this example entirely,
as `testprojects/` is intended to be a home for inputs to
integration tests.  So either we should either write a test that
uses this, or remove it.

[ci skip-rust]

[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants