mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 00:25:15 +00:00 
			
		
		
		
	Merge pull request #1790 from rg3/console-title
Correctly write and restore the console title on the stack (fixes #1782)
This commit is contained in:
		@@ -217,13 +217,15 @@ class YoutubeDL(object):
 | 
				
			|||||||
        if not self.params.get('consoletitle', False):
 | 
					        if not self.params.get('consoletitle', False):
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        if 'TERM' in os.environ:
 | 
					        if 'TERM' in os.environ:
 | 
				
			||||||
            write_string(u'\033[22t', self._screen_file)
 | 
					            # Save the title on stack
 | 
				
			||||||
 | 
					            write_string(u'\033[22;0t', self._screen_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def restore_console_title(self):
 | 
					    def restore_console_title(self):
 | 
				
			||||||
        if not self.params.get('consoletitle', False):
 | 
					        if not self.params.get('consoletitle', False):
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        if 'TERM' in os.environ:
 | 
					        if 'TERM' in os.environ:
 | 
				
			||||||
            write_string(u'\033[23t', self._screen_file)
 | 
					            # Restore the title from stack
 | 
				
			||||||
 | 
					            write_string(u'\033[23;0t', self._screen_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __enter__(self):
 | 
					    def __enter__(self):
 | 
				
			||||||
        self.save_console_title()
 | 
					        self.save_console_title()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user