Repository navigation
application: add --env for spawn environments - #213
Merged
Merged
Conversation
tubibibo
8000
force-pushed
the
feat/spawn-env
branch
from
November 6, 2026 06:46
84fa7c4 to
e32f731
Compare
--aux can only pass string, bool and int values to Device.spawn(), while the env/envp options take a mapping, so there was no way to set an environment variable when spawning, e.g. DISABLE_TWAKS=1 to work around ellekit crashes on iOS. Add a repeatable --env KEY=VALUE that feeds the env parameter, which merges into the environment the spawn would otherwise inherit. Fixes frida#193
oleavr
force-pushed
the
feat/spawn-env
branch
from
November 6, 2026 11:37
e32f731 to
a67ebfd
Compare
Member
|
Thanks! 🙌 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spawning has no way to set environment variables from the CLI today:
--auxforwards its options toDevice.spawn(), but only asstring,boolorint, whileenv/envptake a mapping. So the workaround in #193 — settingDISABLE_TWAKS=1so ellekit does not crash the spawned iOS app — cannot be expressed.This adds a repeatable
--env KEY=VALUEthat feeds the binding'senvparameter, which merges into the environment the spawn would otherwise inherit (unlikeenvp, which replaces it). Values may contain=:--env OTHER=a=byieldsOTHER=a=b. Malformed entries are rejected by the argument parser.It lives in
ConsoleApplication, so every tool that can spawn (frida,frida-trace, …) gets it, and the re-spawn path used when an app restarts goes through the same code, so the environment is applied again.Tests — seven cases in
tests/test_arguments.py:--env, a single variable, multiple variables with an embedded=in one value, and a malformed entryfilespawn path with a fake device and asserting whatDevice.spawn()receives —envis passed when requested, absent when not, and merged alongside--auxoptionsAlso verified end-to-end on Windows with frida 17.24.1: spawning
cmd /c setthrough the CLI with--env FRIDA_E2E=fromclishows the variable in the child's environment while the inheritedPATHis still there; without the flag the variable is absent.completions/frida.fishupdated.Fixes #193