How to use on_fork method in autotest

Best Python code snippet using autotest_python

fork.py

Source:fork.py Github

copy

Full Screen

...112 handle_child_crash()113 def _child_main(self, childfp):114 reset_logging_framework() # Must be first!115 fixup_prngs()116 mitogen.core.Latch._on_fork()117 mitogen.core.Side._on_fork()118 if self.on_fork:119 self.on_fork()120 mitogen.core.set_block(childfp.fileno())121 # Expected by the ExternalContext.main().122 os.dup2(childfp.fileno(), 1)123 os.dup2(childfp.fileno(), 100)124 # Overwritten by ExternalContext.main(); we must replace the125 # parent-inherited descriptors that were closed by Side._on_fork() to126 # avoid ExternalContext.main() accidentally allocating new files over127 # the standard handles.128 os.dup2(childfp.fileno(), 0)129 # Avoid corrupting the stream on fork crash by dupping /dev/null over130 # stderr. Instead, handle_child_crash() uses /dev/tty to log errors.131 devnull = os.open('/dev/null', os.O_WRONLY)132 if devnull != 2:133 os.dup2(devnull, 2)134 os.close(devnull)135 # If we're unlucky, childfp.fileno() may coincidentally be one of our136 # desired FDs. In that case closing it breaks ExternalContext.main().137 if childfp.fileno() not in (0, 1, 100):138 childfp.close()139 config = self.get_econtext_config()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful