added debugging util

This commit is contained in:
William Falcon 2019-07-24 10:34:21 -04:00
parent 96ca1c1b39
commit b41f49dbef
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import pdb
import sys
class ForkedPdb(pdb.Pdb):
"""A Pdb subclass that may be used
from a forked multiprocessing child
"""
def interaction(self, *args, **kwargs):
_stdin = sys.stdin
try:
sys.stdin = open('/dev/stdin')
pdb.Pdb.interaction(self, *args, **kwargs)
finally:
sys.stdin = _stdin