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

Fix thread subproc issue #226

Merged
merged 1 commit into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions news/nothread.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Fixed issue where rever could not be run from within Bash by setting
``$THREAD_SUBPROCS = False``.

**Security:**

* <news item>
9 changes: 6 additions & 3 deletions rever/environ.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ ENVVARS = {


def setup():
orig_thread_subprocs, $THREAD_SUBPROCS = $THREAD_SUBPROCS, False
for name, (default, validate, convert, detype, docstr) in ENVVARS.items():
if name in ${...}:
del ${...}[name]
Expand All @@ -268,25 +269,27 @@ def setup():
detype=detype,
doc=docstr,
)
return orig_thread_subprocs


def teardown():
def teardown(orig_thread_subprocs=True):
for act in $DAG.values():
act.clear_kwargs_from_env()
for name in ENVVARS:
${...}.deregister(name)
if name in ${...}:
del ${...}[name]
$THREAD_SUBPROCS = orig_thread_subprocs


@contextmanager
def context():
"""A context manager for entering and leaving the rever environment
safely.
"""
setup()
orig_thread_subprocs = setup()
yield
teardown()
teardown(orig_thread_subprocs=orig_thread_subprocs)


def rever_envvar_names():
Expand Down