Hello :wave: I am trying to write a plugin that g...
# plugins
r
Hello 👋 I am trying to write a plugin that generates a
pex_binary
target, writes multiple configuration files and then executes the
pex_binary
target with those configuration files. So far, I have successfully done the first 2, but I have no successfully executed the
pex_binary
with
Process
. I have constructed
argv
that includes the path to the
pex_binary
and the necessary configuration files, all of the files exist and the command works when executed from a shell, but with
Process
I’m getting an error
Error launching process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
I suspect that
Process
does not have access to the
pex_binary
. Looking at the code for
Process
, it thought I might need to pass the digest for the
pex_binary
as the
input_digest
for`Process`, but I still get the same error. Should I still include the path for the
pex_binary
in
argv
if I’m passing in
input_digest
or should I assume that
Process
creates the executable from
input_digest
? Does the same apply for the digests for the configuration files used in the command? In that case, how do I refer to each component of the merged digest in
argv
? For example, I need parameters that look like
--config-a a.json --config-b b.json
, how would I refer to
a.json
and
b.json
in
argv
?
1
h
The first pass at debugging should use
--keep-sandboxes=always
to let you poke around inside that process's sandbox, and see what's missing or in the wrong location
If the digests are correct then the pex itself, and the json files, will be at the right relative locations in the sandbox, if not, either the files exist in the sandbox but are in the wrong location, or they don't exist at all
Either way you'll have clues
And the process runs with the sandbox root as its cwd, so you specify config file paths relative to that
r
Thanks, the
--keep-sandboxes=always
tip really helped! It turns out there was a misalignment of relative paths because for
write_digest
I used
path_prefix=
. As far as I can tell, I have to use
path_prefix=
to write a
BuiltPackage
to
DistDir
, but anyways, I’ve managed to work around it.