Encountered a “fun” bug(?) while trying to write a...
# plugins
f
Encountered a “fun” bug(?) while trying to write a test for my plugin. The plugin runs a process and needs an env var, so the rule reads it using
EnvironmentVarsRequest
Copy code
env_vars = await Get(EnvironmentVars, EnvironmentVarsRequest(("HOME",)))

process_request = Process(
    ...
    env = {
        "HOME": env_vars.get("HOME"),
    },
)
result = await Get(FallibleProcessResult, Process, process_request)
But while testing under pants, this env var wasn’t available by default (unknown to me) and the test just kinda hung forever? The little spinner just keeps going and going Eventually I figured out I needed to add the var to the pants toml
Copy code
[test]
extra_env_vars = [
    "HOME"
]
Or change the get to
"HOME": env_vars.get("HOME", ""),
Is there somewhere else I should’ve been checking for logs? I tried setting the log level like this but didn’t see anything extra
Copy code
rule_runner.set_options(
   ["-ltrace"],
   env_inherit={"PATH", "HOME"},
)
What appears to be breaking is setting the value of a env var to
None
when creating the process
Copy code
env = {
    "HOME": None,
}
If I execute the same thing outside a test, I get an infinite loop of
Copy code
[INFO] Filesystem changed during run: retrying `@rule(...)` in 500ms...
h
Yeah, there is a class of issues that end up manifesting as that bogus endless retry loop
It's very unfortunate
f
Whats happening here under the hood, does the rust process crash / what could be done to make it either more resilient or have a better errror?