mirror of
				https://github.com/ytdl-org/youtube-dl.git
				synced 2025-10-29 09:26:20 -07:00 
			
		
		
		
	[utils, etc] Kill child processes when yt-dl is killed
* derived from PR #26592, closes #26592 Authored by: Unrud
This commit is contained in:
		| @@ -16,6 +16,7 @@ from ..utils import ( | ||||
|     is_outdated_version, | ||||
|     PostProcessingError, | ||||
|     prepend_extension, | ||||
|     process_communicate_or_kill, | ||||
|     shell_quote, | ||||
|     subtitles_filename, | ||||
|     dfxp2srt, | ||||
| @@ -180,7 +181,7 @@ class FFmpegPostProcessor(PostProcessor): | ||||
|             handle = subprocess.Popen( | ||||
|                 cmd, stderr=subprocess.PIPE, | ||||
|                 stdout=subprocess.PIPE, stdin=subprocess.PIPE) | ||||
|             stdout_data, stderr_data = handle.communicate() | ||||
|             stdout_data, stderr_data = process_communicate_or_kill(handle) | ||||
|             expected_ret = 0 if self.probe_available else 1 | ||||
|             if handle.wait() != expected_ret: | ||||
|                 return None | ||||
| @@ -228,7 +229,7 @@ class FFmpegPostProcessor(PostProcessor): | ||||
|         if self._downloader.params.get('verbose', False): | ||||
|             self._downloader.to_screen('[debug] ffmpeg command line: %s' % shell_quote(cmd)) | ||||
|         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) | ||||
|         stdout, stderr = p.communicate() | ||||
|         stdout, stderr = process_communicate_or_kill(p) | ||||
|         if p.returncode != 0: | ||||
|             stderr = stderr.decode('utf-8', 'replace') | ||||
|             msgs = stderr.strip().split('\n') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user