mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Xonfig: show sensitive env variables that could affect the shell behavior. (#5374)
* wip * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Added XONSH_SUBPROC_OUTPUT_FORMAT --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
4906ba8598
commit
c4c7d1cbd7
2 changed files with 38 additions and 0 deletions
23
news/xonfig_env.rst
Normal file
23
news/xonfig_env.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* Xonfig: show sensitive env variables that could affect the shell behavior.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -561,6 +561,21 @@ def _info(
|
|||
data.extend([("xontrib", xontribs_loaded())])
|
||||
data.extend([("RC file", XSH.rc_files)])
|
||||
|
||||
# Show sensitive env variables that could affect the shell behavior.
|
||||
envs = {
|
||||
"UPDATE_OS_ENVIRON": None,
|
||||
"XONSH_CAPTURE_ALWAYS": None,
|
||||
"XONSH_SUBPROC_OUTPUT_FORMAT": None,
|
||||
"THREAD_SUBPROCS": None,
|
||||
"ENABLE_ASYNC_PROMPT": True,
|
||||
"ENABLE_COMMANDS_CACHE": False,
|
||||
"XONSH_CACHE_EVERYTHING": True,
|
||||
"XONSH_CACHE_SCRIPTS": None,
|
||||
}
|
||||
for e, show_if in envs.items():
|
||||
if (val := XSH.env.get(e)) is not None and (show_if is None or val == show_if):
|
||||
data.extend([(e, val)])
|
||||
|
||||
formatter = _xonfig_format_json if to_json else _xonfig_format_human
|
||||
s = formatter(data)
|
||||
return s
|
||||
|
|
Loading…
Add table
Reference in a new issue