about summary refs log tree commit diff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-01-09 17:56:12 +0530
committerdirkf <fieldhouse@gmx.net>2022-06-10 19:57:46 +0100
commit0700fde6403aa9eec1ff02bff7323696a205900c (patch)
treef1ed405d2af1934a06ff2091420172a0cc98f23a /youtube_dl/compat.py
parent811c480f7b6c25ca510a033e6365d00174135392 (diff)
downloadyoutube-dl-0700fde6403aa9eec1ff02bff7323696a205900c.tar.gz
youtube-dl-0700fde6403aa9eec1ff02bff7323696a205900c.tar.xz
youtube-dl-0700fde6403aa9eec1ff02bff7323696a205900c.zip
[utils, etc] Kill child processes when yt-dl is killed
* derived from PR #26592, closes #26592

Authored by: Unrud
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 2004a405a..9f5f85dae 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -2890,6 +2890,7 @@ else:
     _terminal_size = collections.namedtuple('terminal_size', ['columns', 'lines'])
 
     def compat_get_terminal_size(fallback=(80, 24)):
+        from .utils import process_communicate_or_kill
         columns = compat_getenv('COLUMNS')
         if columns:
             columns = int(columns)
@@ -2906,7 +2907,7 @@ else:
                 sp = subprocess.Popen(
                     ['stty', 'size'],
                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-                out, err = sp.communicate()
+                out, err = process_communicate_or_kill(sp)
                 _lines, _columns = map(int, out.split())
             except Exception:
                 _columns, _lines = _terminal_size(*fallback)