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

add ST2_USE_DEBUGGER env var to mirror --use-debugger arg #5675

Merged
merged 1 commit into from
Jul 19, 2022
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
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Added
* Added graceful shutdown for workflow engine. #5463
Contributed by @khushboobhatia01

* Add ``ST2_USE_DEBUGGER`` env var as alternative to the ``--use-debugger`` cli flag. #5675
Contributed by @cognifloyd

Changed
~~~~~~~

Expand Down
6 changes: 6 additions & 0 deletions st2common/st2common/util/monkey_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from __future__ import absolute_import

import os
import sys

__all__ = [
Expand All @@ -29,6 +30,7 @@

USE_DEBUGGER_FLAG = "--use-debugger"
PARENT_ARGS_FLAG = "--parent-args="
USE_DEBUGGER_ENV_VAR = "ST2_USE_DEBUGGER"


def monkey_patch(patch_thread=None):
Expand Down Expand Up @@ -117,4 +119,8 @@ def is_use_debugger_flag_provided():
if arg.startswith(PARENT_ARGS_FLAG) and USE_DEBUGGER_FLAG in arg:
return True

# 3. Check for ST2_USE_DEBUGGER env var
if os.environ.get(USE_DEBUGGER_ENV_VAR, False):
return True

return False