| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 
 |  
 
if os.fork() == 0:                                                                                                                                                            
         maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]                                                                                                                    
         if (maxfd == resource.RLIM_INFINITY):                                                                                                                                    
              maxfd = 1024                                                                                                                                                        
 
         # Iterate through and close all file descriptors.                                                                                                                        
         for fd in range(0, maxfd):                                                                                                                                               
             try:                                                                                                                                                                 
                 os.close(fd)                                                                                                                                                     
             except OSError:     # ERROR, fd wasn't open to begin with (ignored)                                                                                                  
                 pass                                                                                                                                                             
 
         os.setsid()                                                                                                                                                              
 
         sys.stderr = open("/dev/null", 'w')                                                                                                                                      
         sys.stdout = open("/dev/null", 'w')                                                                                                                                      
         sys.stdin = open("/dev/null", 'r')                                                                                                                                       
         if os.fork() == 0:                                                                                                                                                       
             #processing...                                                                                                                                                       
             launch(run_id, req)                                                                                                                                                  
 
         sys.exit(0) | 
Partager