Repository: yt-dlp
Issue: yt-dlp does not pass signals to the external downloader.
Labels: bug,triage,core:downloader

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

The most common use case of this is sending SIGINT via the terminal; what one would expect is that yt-dlp sends the SIGINT to the external downloader (aria2c for e.g.), but it sends something else to it to terminate it (possibly SIGKILL).

This can have a verity of consequences. For aria2c, the stop-resume support for multithreaded download cannot be used because aria2c writes to the .aria2 command for information on how to resume the multi-segmented downloaded. e.g. -- 
-rw-r----- 1 de      de      2.8K Apr  6 14:32 'Suzuki_DR650_-_The_Motorcycle_that_Built_a_Community-[o_ZJy-J96oE].f313.webm.part.aria2'                                                                                                                                    
-rw-r----- 1 de      de      621M Apr  6 14:32 'Suzuki_DR650_-_The_Motorcycle_that_Built_a_Community-[o_ZJy-J96oE].f313.webm.part'

If you do just plane ctrl-c with aria2c as an external downloader, this file is never created. As a workaround, if you intend to stop with resume support in aria2c, you can execute the following commands in a separate terminal -- 
pkill -SIGSTOP yt-dlp; pkill -SIGINT aria2c; pkill -SIGKILL yt-dlp
This will allow aria2c to intercept the SIGINT and write the aria2c file.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
This is the output as I press ctrl-c. Note 'ERROR: Interrupted by user' is the output of yt-dlp, not aria2c -- 

yt-dlp -vU --restrict-filenames --external-downloader aria2c --external-downloader-args '-U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37" --continue=false --always-resume=false --auto-file-renaming=false -x16 -k10M --piece-length=20M -s20 --ftp-reuse-connection=true --auto-save-interval=0 --http-accept-gzip=true --remote-time=false --disk-cache=0 --enable-mmap=false --file-allocation=none --max-download-result=1 --no-conf=true --connect-timeout=10 -m10 --retry-wait=5 -t30 --max-resume-failure-tries=0' --no-mtime --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37' https://www.youtube.com/watch?v=o_ZJy-J96oE
[debug] Command-line config: ['-vU', '--restrict-filenames', '--external-downloader', 'aria2c', '--external-downloader-args', '-U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37" --continue=false --always-resume=false --auto-file-renaming=false -x16 -k10M --piece-length=20M -s20 --ftp-reuse-connection=true --auto-save-interval=0 --http-accept-gzip=true --remote-time=false --disk-cache=0 --enable-mmap=false --file-allocation=none --max-download-result=1 --no-conf=true --connect-timeout=10 -m10 --retry-wait=5 -t30 --max-resume-failure-tries=0', '--no-mtime', '--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37', 'https://www.youtube.com/watch?v=o_ZJy-J96oE']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version local@2024.04.06 [9073ae645]
[debug] Python 3.11.8 (CPython x86_64 64bit) - Linux-6.1.70-gentoo-gentoo-dist-x86_64-12th_Gen_Intel-R-_Core-TM-_i3-12100-with-glibc2.38 (OpenSSL 3.0.13 30 Jan 2024, glibc 2.38)
[debug] exe versions: ffmpeg 4.4.4 (fdk,setts), ffprobe 4.4.4
[debug] Optional libraries: brotlicffi-1.1.0.0, certifi-3021.03.16, pycrypto-3.20.0, requests-2.31.0, sqlite3-3.45.1, urllib3-2.1.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests
WARNING: External Downloader arguments given without specifying name. The arguments will be given to aria2c
[debug] Loaded 1809 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.03.10 from yt-dlp/yt-dlp
yt-dlp is up to date (local@2024.04.06)
[youtube] Extracting URL: https://www.youtube.com/watch?v=o_ZJy-J96oE
[youtube] o_ZJy-J96oE: Downloading webpage
[youtube] o_ZJy-J96oE: Downloading ios player API JSON
[youtube] o_ZJy-J96oE: Downloading android player API JSON
[youtube] o_ZJy-J96oE: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] o_ZJy-J96oE: Downloading 1 format(s): 313+251
[debug] Invoking aria2c downloader on "https://rr5---sn-gwpa-qxaez.googlevideo.com/videoplayback?expire=1712417887&ei=_xcRZsjkENmj9fwP87-B8As&ip=2405%3A201%3A4029%3Ad014%3A4189%3A7c24%3A3fd5%3A1d8d&id=o-ANaF-JB7geCSRIOIKqRGAIQ94w26Gi57Te-otj6gozDt&itag=313&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=gH&mm=31%2C29&mn=sn-gwpa-qxaez%2Csn-gwpa-qxas&ms=au%2Crdu&mv=m&mvi=5&pl=49&initcwndbps=1332500&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=685821690&dur=565.022&lmt=1711927353075666&mt=1712395970&fvip=1&keepalive=yes&fexp=51141541&c=IOS&txp=5532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRgIhAJHezuQgJmVSAsHoeJYspLaVvhxZHqA2zadgtMtfpm3GAiEAwbvaIUL6hDESyHKZAGoS6wNxRmbB9OarDHZPFHiAc0Y%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ALClDIEwRAIgAZbsvAu8RSFuz6XGzM6R5GzsMpkooLZFD-hejjxXDn0CIExFWZBtm0s8pdPfy62KwLDC3-nNZi35bILKRwYyueHz"
[download] Destination: Suzuki_DR650_-_The_Motorcycle_that_Built_a_Community-[o_ZJy-J96oE].f313.webm
[debug] aria2c command line: aria2c -c --no-conf --console-log-level=warn --summary-interval=0 --download-result=hide --http-accept-gzip=true --file-allocation=none -x16 -j16 -s16 --min-split-size 1M --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'Accept-Language: en-us,en;q=0.5' --header 'Sec-Fetch-Mode: navigate' --check-certificate=true --remote-time=false --show-console-readout=true -U 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37' --continue=false --always-resume=false --auto-file-renaming=false -x16 -k10M --piece-length=20M -s20 --ftp-reuse-connection=true --auto-save-interval=0 --http-accept-gzip=true --remote-time=false --disk-cache=0 --enable-mmap=false --file-allocation=none --max-download-result=1 --no-conf=true --connect-timeout=10 -m10 --retry-wait=5 -t30 --max-resume-failure-tries=0 --out './Suzuki_DR650_-_The_Motorcycle_that_Built_a_Community-[o_ZJy-J96oE].f313.webm.part' --auto-file-renaming=false -- 'https://rr5---sn-gwpa-qxaez.googlevideo.com/videoplayback?expire=1712417887&ei=_xcRZsjkENmj9fwP87-B8As&ip=2405%3A201%3A4029%3Ad014%3A4189%3A7c24%3A3fd5%3A1d8d&id=o-ANaF-JB7geCSRIOIKqRGAIQ94w26Gi57Te-otj6gozDt&itag=313&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=gH&mm=31%2C29&mn=sn-gwpa-qxaez%2Csn-gwpa-qxas&ms=au%2Crdu&mv=m&mvi=5&pl=49&initcwndbps=1332500&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=685821690&dur=565.022&lmt=1711927353075666&mt=1712395970&fvip=1&keepalive=yes&fexp=51141541&c=IOS&txp=5532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRgIhAJHezuQgJmVSAsHoeJYspLaVvhxZHqA2zadgtMtfpm3GAiEAwbvaIUL6hDESyHKZAGoS6wNxRmbB9OarDHZPFHiAc0Y%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ALClDIEwRAIgAZbsvAu8RSFuz6XGzM6R5GzsMpkooLZFD-hejjxXDn0CIExFWZBtm0s8pdPfy62KwLDC3-nNZi35bILKRwYyueHz'
[#8f2009 4.3MiB/654MiB(0%) CN:16 DL:1.1MiB ETA:9m7s]^C                                                                               
ERROR: Interrupted by user

Expected is output of aria2c as in this e.g. (where pkill -SIGSTOP yt-dlp; pkill -SIGINT aria2c; pkill -SIGKILL yt-dlp has been used to stop the download) -- 
yt-dlp --restrict-filenames --external-downloader aria2c --external-downloader-args '-U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37" --continue=false --always-resume=false --auto-file-renaming=false -x16 -k10M --piece-length=20M -s20 --ftp-reuse-connection=true --auto-save-interval=0 --http-accept-gzip=true --remote-time=false --disk-cache=0 --enable-mmap=false --file-allocation=none --max-download-result=1 --no-conf=true --connect-timeout=10 -m10 --retry-wait=5 -t30 --max-resume-failure-tries=0' --no-mtime --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37' https://www.youtube.com/watch?v=o_ZJy-J96oE
WARNING: External Downloader arguments given without specifying name. The arguments will be given to aria2c
[youtube] Extracting URL: https://www.youtube.com/watch?v=o_ZJy-J96oE
[youtube] o_ZJy-J96oE: Downloading webpage
[youtube] o_ZJy-J96oE: Downloading ios player API JSON
[youtube] o_ZJy-J96oE: Downloading android player API JSON
[youtube] o_ZJy-J96oE: Downloading m3u8 information
[info] o_ZJy-J96oE: Downloading 1 format(s): 313+251
[download] Destination: Suzuki_DR650_-_The_Motorcycle_that_Built_a_Community-[o_ZJy-J96oE].f313.webm
[#0373b9 9.4MiB/654MiB(1%) CN:16 DL:1.2MiB ETA:8m52s]                                                                                
[1]+  Stopped                 yt-dlp --restrict-filenames --external-downloader aria2c --external-downloader-args '-U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37" --continue=false --always-resume=false --auto-file-renaming=false -x16 -k10M --piece-length=20M -s20 --ftp-reuse-connection=true --auto-save-interval=0 --http-accept-gzip=true --remote-time=false --disk-cache=0 --enable-mmap=false --file-allocation=none --max-download-result=1 --no-conf=true --connect-timeout=10 -m10 --retry-wait=5 -t30 --max-resume-failure-tries=0' --no-mtime --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37' https://www.youtube.com/watch?v=o_ZJy-J96oE
de@desktopminer /tmp $ 
aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.

Note the -- 
aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details. 

which is not printed in the previous output.