mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Also close file descriptors from os.popen and subprocess.Popen
This commit is contained in:
		
							parent
							
								
									25b5741383
								
							
						
					
					
						commit
						5ac6d80c02
					
				
					 2 changed files with 25 additions and 19 deletions
				
			
		|  | @ -343,22 +343,26 @@ def run(self): | |||
|             src_rpm, non_src_rpm, spec_path) | ||||
| 
 | ||||
|         out = os.popen(q_cmd) | ||||
|         binary_rpms = [] | ||||
|         source_rpm = None | ||||
|         while True: | ||||
|             line = out.readline() | ||||
|             if not line: | ||||
|                 break | ||||
|             l = line.strip().split() | ||||
|             assert(len(l) == 2) | ||||
|             binary_rpms.append(l[1]) | ||||
|             # The source rpm is named after the first entry in the spec file | ||||
|             if source_rpm is None: | ||||
|                 source_rpm = l[0] | ||||
|         try: | ||||
|             binary_rpms = [] | ||||
|             source_rpm = None | ||||
|             while True: | ||||
|                 line = out.readline() | ||||
|                 if not line: | ||||
|                     break | ||||
|                 l = line.strip().split() | ||||
|                 assert(len(l) == 2) | ||||
|                 binary_rpms.append(l[1]) | ||||
|                 # The source rpm is named after the first entry in the spec file | ||||
|                 if source_rpm is None: | ||||
|                     source_rpm = l[0] | ||||
| 
 | ||||
|         status = out.close() | ||||
|         if status: | ||||
|             raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd)) | ||||
|             status = out.close() | ||||
|             if status: | ||||
|                 raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd)) | ||||
| 
 | ||||
|         finally: | ||||
|             out.close() | ||||
| 
 | ||||
|         self.spawn(rpm_cmd) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Éric Araujo
						Éric Araujo