Created
March 29, 2019 17:29
-
-
Save joaorafaelm/81308d7d54b4797653d235ddc69eaf11 to your computer and use it in GitHub Desktop.
sub process debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pdb | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment