Opened at 2012-01-06T00:10:56Z
Last modified at 2020-01-13T20:44:49Z
#1651 closed defect
remove exec() from the codebase — at Initial Version
Reported by: | warner | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | eventually |
Component: | code | Version: | 1.9.0 |
Keywords: | exec pythonpath subprocess test | Cc: | |
Launchpad Bug: |
Description
We've had a number of "what version of the code are we running anyways?" problems, provoking tremendous heroics in the setuptools-based dependency-version-management code, that could go away entirely if we got rid of the use of exec() in the codebase (reducing the use of fork() would be good too, but not as critical).
As I remember, fork+exec came up as a way to make tahoe start cleanly daemonize, by executing twistd as a child process. Since then, I've figured out ways to use twistd's own code for this purpose, starting with an import and ending with a function call (which never returns, because the twistd code invokes fork and then os._exit() the parent).
To keep tahoe start from killing off the trial process during unit tests, we can do a fork() inside tahoe start before calling twistd. We should investigate how well this works on windows (I think we might skip that test on windows anyways).
I think this would let us get rid of a lot of code, followed by removing a lot of setuptools-ish code (the stuff that touches os.environ[PYTHONPATH] and os.environ[PATH], and the tests that assert things about the version of code found by the tahoe start child). And *that* might let us reduce our dependency on setuptools and versioning stuff in general, at least a little bit.