Hey y'all. Thanks for always helping out. I've lea...
# general
s
Hey y'all. Thanks for always helping out. I've learned a lot from this channel. My project uses a 3rd-party dependency that interfaces with USB cameras, and on my platform, it has to be run with sudo. However,
sudo pants run
seems to have some unexpected side-effects. Mainly, it changes ownership of .pants.d/, among other paths, so that when I go to run pants commands without sudo, I get permission denied errors. A
chown
of the relevant directories gets things back to normal, but I'm wondering if there's any way to avoid this?
h
That sounds like an issue well beyond Pants. Any process you run that creates files will have this problem.
Maybe you can have a separate pants workdir for when you sudo
I.e., have a “sudo only” extra Pants config file that sets
pants_subprocessdir
and
pants_workdir
to some other location
And then use
sudo pants --pants-config-files=pants.sudo.toml run ...
You can script that up, obviously
There may be one or two other things to repoint, such as the local cache location
s
That's a good thought. I'll give it a try. Just to double-check, I don't suppose there would be a way to run a pants subprocess as sudo without the entire invocation? I guess I might be able to build a pex and run that with sudo, but that has other downsides.
I guess for one-off testing, it's probably better to just fiddle with the PYTHONPATH and use the python command, instead.