<#16807 Ability to set working dir for `experiment...
# github-notifications
q
#16807 Ability to set working dir for `experimental_shell_command` Issue created by danxmoran Is your feature request related to a problem? Please describe. We (unfortunately) have a build script that is hard-coded to write to
../../some/dir
. I tried putting an
experimental_shell_command
into the same directory as the script with
outputs=["../../some/dir"]
, but that failed with error
Relative paths that escape the root are not allowed
. To get things working, I had to move the
experimental_shell_command
to the root of my repo and set the
command
to
"cd path/to/script/dir && ./script"
(the script unfortunately cares that it's run from the same directory). I was then able to set
outputs=["some/dir/"]
. Describe the solution you'd like It makes sense to me that shell commands can't write outputs to parent dirs, but it would be nice if there was a cleaner way to say "run this command in a subdir workdir". A
work_directory
field on
experimental_shell_command
would do the trick, I think. Describe alternatives you've considered Things seem to work fine with the
cd
so we aren't blocked, it's just messy and raised some eyebrows during review. pantsbuild/pants