mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Ensure tempfile is unlinked
This commit is contained in:
		
							parent
							
								
									59481f5bb0
								
							
						
					
					
						commit
						1740a1f20e
					
				| 
						 | 
				
			
			@ -616,6 +616,7 @@ def _save_netpbm(im, fp, filename):
 | 
			
		|||
    # below for information on how to enable this.
 | 
			
		||||
    tempfile = im._dump()
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        with open(filename, "wb") as f:
 | 
			
		||||
            if im.mode != "RGB":
 | 
			
		||||
                subprocess.check_call(
 | 
			
		||||
| 
						 | 
				
			
			@ -630,7 +631,10 @@ def _save_netpbm(im, fp, filename):
 | 
			
		|||
                    quant_cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
 | 
			
		||||
                )
 | 
			
		||||
                togif_proc = subprocess.Popen(
 | 
			
		||||
                togif_cmd, stdin=quant_proc.stdout, stdout=f, stderr=subprocess.DEVNULL
 | 
			
		||||
                    togif_cmd,
 | 
			
		||||
                    stdin=quant_proc.stdout,
 | 
			
		||||
                    stdout=f,
 | 
			
		||||
                    stderr=subprocess.DEVNULL,
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
                # Allow ppmquant to receive SIGPIPE if ppmtogif exits
 | 
			
		||||
| 
						 | 
				
			
			@ -643,7 +647,7 @@ def _save_netpbm(im, fp, filename):
 | 
			
		|||
                retcode = togif_proc.wait()
 | 
			
		||||
                if retcode:
 | 
			
		||||
                    raise subprocess.CalledProcessError(retcode, togif_cmd)
 | 
			
		||||
 | 
			
		||||
    finally:
 | 
			
		||||
        try:
 | 
			
		||||
            os.unlink(tempfile)
 | 
			
		||||
        except OSError:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user