mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Add thread details to the exception (#5360)
* thread details * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- 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
af9c3afa23
commit
273f12d329
3 changed files with 13 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
**Added:**
|
**Added:**
|
||||||
|
|
||||||
* Added detailed thread name to thread exceptions.
|
* Added thread class, name, func and alias names to thread exception for easy understanding the source of issue.
|
||||||
|
|
||||||
**Changed:**
|
**Changed:**
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,14 @@ class PopenThread(threading.Thread):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
self.pid = proc.pid
|
self.pid = proc.pid
|
||||||
self.name = repr({"name": self.name, "cmd": args, "pid": self.pid})
|
self.name = repr(
|
||||||
|
{
|
||||||
|
"cls": self.__class__.__name__,
|
||||||
|
"name": self.name,
|
||||||
|
"cmd": args,
|
||||||
|
"pid": self.pid,
|
||||||
|
}
|
||||||
|
)
|
||||||
self.universal_newlines = uninew = proc.universal_newlines
|
self.universal_newlines = uninew = proc.universal_newlines
|
||||||
if uninew:
|
if uninew:
|
||||||
self.encoding = enc = env.get("XONSH_ENCODING")
|
self.encoding = enc = env.get("XONSH_ENCODING")
|
||||||
|
|
|
@ -351,9 +351,12 @@ def partial_proxy(f):
|
||||||
def get_proc_proxy_name(cls):
|
def get_proc_proxy_name(cls):
|
||||||
func_name = cls.f
|
func_name = cls.f
|
||||||
if type(cls.f) is functools.partial:
|
if type(cls.f) is functools.partial:
|
||||||
func_name = getattr(cls.f.args[0], "__name__", cls.f)
|
func_name = getattr(
|
||||||
|
cls.f.args[0], "__name__", getattr(cls.f, "__name__", cls.f)
|
||||||
|
)
|
||||||
return repr(
|
return repr(
|
||||||
{
|
{
|
||||||
|
"cls": cls.__class__.__name__,
|
||||||
"name": getattr(cls, "name", None),
|
"name": getattr(cls, "name", None),
|
||||||
"func": func_name,
|
"func": func_name,
|
||||||
"alias": cls.env.get("__ALIAS_NAME", None),
|
"alias": cls.env.get("__ALIAS_NAME", None),
|
||||||
|
|
Loading…
Add table
Reference in a new issue