mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-10-16 13:38:07 -07:00
[utils] setproctitle: Fix NUL termination (#17724)
Authored by: doe1080
This commit is contained in:
@@ -107,6 +107,7 @@ from yt_dlp.utils import (
|
||||
sanitize_filename,
|
||||
sanitize_path,
|
||||
sanitize_url,
|
||||
setproctitle,
|
||||
shell_quote,
|
||||
strftime_or_none,
|
||||
smuggle_url,
|
||||
@@ -613,6 +614,14 @@ class TestUtil(unittest.TestCase):
|
||||
self.assertEqual(res_url, url)
|
||||
self.assertEqual(res_data, {'a': 'b', 'c': 'd'})
|
||||
|
||||
@unittest.mock.patch('ctypes.cdll.LoadLibrary')
|
||||
def test_setproctitle(self, load_library):
|
||||
for title in ('yt-dlp', 'café'):
|
||||
with self.subTest(title=title):
|
||||
setproctitle(title)
|
||||
buf = load_library.return_value.prctl.call_args.args[1]
|
||||
self.assertEqual(bytes(buf), title.encode() + b'\0')
|
||||
|
||||
def test_shell_quote(self):
|
||||
args = ['ffmpeg', '-i', 'ñ€ß\'.mp4']
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user