Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawnProcess() passes incorrect environment to subprocess when env=None and posix_spawnp() is used #12068

Closed
p12tic opened this issue Dec 26, 2023 · 0 comments · Fixed by #12069
Labels

Comments

@p12tic
Copy link
Contributor

p12tic commented Dec 26, 2023

Documentation on reactor.spawnProcess says the following about env parameter:

env is None: On POSIX: pass os.environ

However, twisted has this code in the code path leading to a call to posix_spawnp().

if environment is None:
    environment = {}

This leads to a subprocess being initialized with empty environment even though os.environ was expected.

Describe how to cause this behavior

There's a PR with automated tests added to Twisted.

Describe the correct behavior you'd like to see

Subprocess having parent process environment when invoked via reactor.spawnProcess(..., env=None).

Testing environment

  • Operating System and Version;
    • Debian 12
  • Twisted version: 23.10.0
  • Reactor: default on Linux

Additional context
Probably a regression since 23.8.0 when posix_spawnp was enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant