2020-06-05 02:27:19 +02:00
|
|
|
"""Simple built-in debugger. Runs pdb on reception of SIGUSR1 signal."""
|
|
|
|
import signal
|
|
|
|
|
2022-05-30 15:33:17 +05:30
|
|
|
from xonsh.built_ins import XonshSession
|
2020-06-05 02:27:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
def handle_sigusr1(sig, frame):
|
|
|
|
print("\nSIGUSR1 signal received. Starting interactive debugger...", flush=True)
|
2022-07-01 21:17:01 +05:30
|
|
|
import pdb # noqa
|
2020-06-05 02:27:19 +02:00
|
|
|
|
2022-07-01 21:17:01 +05:30
|
|
|
pdb.Pdb().set_trace(frame) # noqa
|
2020-06-05 02:27:19 +02:00
|
|
|
|
|
|
|
|
2022-05-30 15:33:17 +05:30
|
|
|
def _load_xontrib_(xsh: XonshSession, **_):
|
|
|
|
signal.signal(signal.SIGUSR1, handle_sigusr1)
|