Skip to content

Instantly share code, notes, and snippets.

@joaorafaelm
Created March 29, 2019 17:29
Show Gist options
  • Save joaorafaelm/81308d7d54b4797653d235ddc69eaf11 to your computer and use it in GitHub Desktop.
Save joaorafaelm/81308d7d54b4797653d235ddc69eaf11 to your computer and use it in GitHub Desktop.
sub process debugging
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