Skip to content

Add cwd and env parameters to Flow.spawn()#15

Merged
ab-10 merged 2 commits intomainfrom
feature/flow-cwd-env-support
Jan 27, 2026
Merged

Add cwd and env parameters to Flow.spawn()#15
ab-10 merged 2 commits intomainfrom
feature/flow-cwd-env-support

Conversation

@recursiveAF
Copy link
Contributor

Summary

  • Add cwd parameter to set working directory for terminal sessions (uses tmux -c flag)
  • Add env parameter to set environment variables in the session
  • User env vars are merged with mitmproxy env vars (proxy settings take precedence)

Usage

# Before (shell workaround)
Flow.spawn(f"cd {path} && {cmd}")

# After (clean API)
Flow.spawn(cmd, cwd=path, env={"HOME": "/tmp", "GT_TEST_MODE": "1"})

Test plan

  • Test cwd sets the working directory correctly
  • Test env sets environment variables correctly
  • Test cwd and env work together
  • Test env vars don't leak between Flow instances

Run tests with: pytest tests/test_flow_cwd_env.py -v -s

🤖 Generated with Claude Code

recursiveAF and others added 2 commits January 27, 2026 09:03
Allow tests to specify working directory and environment variables
without shell workarounds like `cd path && cmd`.

- Add cwd parameter to Terminal.start() using tmux -c flag
- Add cwd and env parameters to Flow.__init__() and Flow.spawn()
- Merge user env with mitmproxy env in Flow.__enter__()
- Add tests for cwd, env, and env isolation between flows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ab-10 ab-10 merged commit 4b0fb63 into main Jan 27, 2026
2 checks passed
@ab-10 ab-10 deleted the feature/flow-cwd-env-support branch January 27, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants