Add to the process environment rather than replacing it

Matches the exec path this was ported from; the guest command already starts
with env -i, so clearing the host side changed nothing except how far the code
sits from a configuration proven on a device.
This commit is contained in:
The412Banner committed 2026-09-19 14:01:08 -04:00
1 parent 085f663347
commit 814ab2cac0
1 file changed
+4 -1
@@ -37,7 +37,10 @@ public final class ProcessHelper {
ProcessBuilder builder = new ProcessBuilder(splitCommand(command));
if (workingDir != null) builder.directory(workingDir);
if (envp != null) {
builder.environment().clear();
// Added to the app's own environment rather than replacing it, which is what
// Bannerlator does on the path this was taken from. proot needs nothing from the
// inherited set, but the guest command starts with `env -i` anyway, so clearing
// here buys nothing and only differs from the configuration proven on a device.
for (String entry : envp) {
int eq = entry.indexOf('=');
if (eq > 0) builder.environment().put(entry.substring(0, eq), entry.substring(eq + 1));