QQ, how do I tell a `pex_binary` defined tool to r...
# general
f
QQ, how do I tell a
pex_binary
defined tool to run within a specific directory in my codebase? Tools that I use with
run_shell_command
have the
workdir
parameter. I don't notice anything similar for
pex_binary
e
a
pex_binary
should be treated more like an executable. Its a "compiled" file that could be copied to other locations, or sent to other people/machines. It probably shouldn't be expecting to run in a particular directory (ie. not be using internal relative paths), or if it is, it should be understood that it must be placed and executed in a directory that matches what it expects. (eg. it may look for a config file in $PWD, but should probably use nice defaults or fail with a helpful error message if the config file is not present)
So without knowing your exact situation, I think your tool should be expecting CLI args, env vars, or a config file that direct it to any filesystem locations it may need
f
Thanks! I'm depending on a 3rd party utility (the Fivetran development SDK) and there is a firm requirement that it is run from a specific directory in my source folder for it to discover my python files and deploy it
e
If you run it from the correct location does it work correctly? if so, the simplest thing is probably to just let everybody know it follows the behavior of Fivetran and has to run from the right location. The other option is to make your pex entrypoint a wrapper around the actual tool that can take an arg however you want and then
cd
there and then run Fivetran
f
Thanks for the tips! The first method works, and I'll give the 2nd method a try