https://pantsbuild.org/ logo
#general
Title
# general
n

nice-florist-55958

08/09/2022, 7:41 PM
What could cause
experimental_shell_command
to report a
/usr/bin/bash: my_script.sh: command not found
error regarding the
command="./my_script.sh"
script field? When I change it to something like
ls -la ./ && echo $(pwd)
I see the expected
.sh
file bundled from the
shell_sources
dependency. I also see it and can run it directly from the preserved workspace. The error just doesn't make sense and I've trippled-checked the spelling. Using 2.13.0.dev5.
Seems a temporary fix is
command="ls my_script.sh | xargs bash"
e

enough-analyst-54434

08/09/2022, 10:04 PM
What is your script's shebang and what is your `experimental_shell_command`'s `tools`list?
n

nice-florist-55958

08/09/2022, 10:22 PM
#!/bin/ksh
- that would explain it.
@enough-analyst-54434 May have spoken too soon. I seem to keep getting the same error if I include
ksh
in the tools list. If I run the script directly as bash -c "my_script.sh" I don't have an issue (I believe this is the invocation by Pants, but I can't tell exactly from just looking at the rule method). It doesn't seem to matter what the shebang is -- same behavior if I remove it, change it to
#!/bin/bash
, etc. The script is in the expected location in the preserved sandbox and the xargs invocation continues to work.
e

enough-analyst-54434

08/10/2022, 2:50 PM
If I run the script directly as bash -c "my_script.sh" I don't have an issue (I believe this is the invocation by Pants, but I can't tell exactly from just looking at the rule method).
Instead of reading rule code, you can just read
__run.sh
in the preserved sandbox. Is there any way you can provide the preserved sandbox `__run.sh`script and ditto for whatever it points to - presumably
src/my_script.sh
or similar?
4 Views