1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 09:12:40 +01:00
yt-dlp/yt_dlp
pukkandan b25522ba52
[update] Replace self without launching a subprocess in windows
Closes: #335, https://github.com/ytdl-org/youtube-dl/issues/28488, https://github.com/ytdl-org/youtube-dl/issues/5810, https://github.com/ytdl-org/youtube-dl/issues/5994

In windows, a running executable cannot be replaced. So, the old updater worked by launching a batch script and then exiting, so that the batch script can replace the executable. However, this caused the above-mentioned issues.

The new method takes advantage of the fact that while the executable cannot be replaced or deleted, it can still be renamed. The current update process on windows is as follows:
1. Delete `yt-dlp.exe.old` if it exists
2. Download the new version as `yt-dlp.exe.new`
3. Rename the running exe to `yt-dlp.exe.old`
4. Rename `yt-dlp.exe.new` to `yt-dlp.exe`
5. Open a shell that deletes `yt-dlp.exe.old` and terminate

While we still use a subprocess, the actual update is already done before the app terminates and the batch script does not print anything to stdout/stderr. So this solves all the above issues
2021-05-26 01:13:34 +05:30
..
downloader [ffmpeg] Download and merge in a single step if possible 2021-05-23 03:53:18 +05:30
extractor [ard] Allow URLs without - before id 2021-05-23 23:03:08 +05:30
postprocessor [ard] Allow URLs without - before id 2021-05-23 23:03:08 +05:30
__init__.py [cleanup] Refactor updater 2021-05-26 01:13:08 +05:30
__main__.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
aes.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
cache.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
compat.py [downloader/hls] Assemble single-file WebVTT subtitles from HLS segments 2021-04-28 17:21:14 +05:30
jsinterp.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
options.py [cleanup] Refactor ffmpeg convertors 2021-05-22 15:20:42 +05:30
socks.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
swfinterp.py Completely change project name to yt-dlp (#85) 2021-02-25 00:15:56 +05:30
update.py [update] Replace self without launching a subprocess in windows 2021-05-26 01:13:34 +05:30
utils.py Handle Basic Auth user:pass in URLs 2021-05-24 03:38:02 +05:30
version.py [version] update 2021-05-20 21:15:41 +05:30
webvtt.py [downloader/hls] Remove duplicate cues using a sliding window of candidates 2021-04-28 17:21:26 +05:30
YoutubeDL.py [cleanup] Refactor updater 2021-05-26 01:13:08 +05:30