mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 22:34:01 -07:00
Merge 78d9d0b725
into 384f632e8a
This commit is contained in:
commit
f47a93631e
2 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,7 @@ from .options import (
|
|||
parseOpts,
|
||||
)
|
||||
from .compat import (
|
||||
compat_BrokenPipeError,
|
||||
compat_getpass,
|
||||
compat_shlex_split,
|
||||
workaround_optparse_bug9161,
|
||||
|
@ -25,6 +26,7 @@ from .utils import (
|
|||
decodeOption,
|
||||
DEFAULT_OUTTMPL,
|
||||
DownloadError,
|
||||
error_to_compat_str,
|
||||
expand_path,
|
||||
match_filter_func,
|
||||
MaxDownloadsReached,
|
||||
|
@ -479,6 +481,12 @@ def main(argv=None):
|
|||
sys.exit('ERROR: fixed output name but more than one file to download')
|
||||
except KeyboardInterrupt:
|
||||
sys.exit('\nERROR: Interrupted by user')
|
||||
except compat_BrokenPipeError as err:
|
||||
# See "Note on SIGPIPE"
|
||||
# https://docs.python.org/3/library/signal.html#note-on-sigpipe
|
||||
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||
os.dup2(devnull, sys.stdout.fileno())
|
||||
sys.exit('ERROR: %s' % error_to_compat_str(err))
|
||||
|
||||
|
||||
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']
|
||||
|
|
|
@ -3094,7 +3094,14 @@ else:
|
|||
return ctypes.WINFUNCTYPE(*args, **kwargs)
|
||||
|
||||
|
||||
try: # Python >= 3.3
|
||||
compat_BrokenPipeError = BrokenPipeError
|
||||
except NameError:
|
||||
compat_BrokenPipeError = IOError
|
||||
|
||||
|
||||
__all__ = [
|
||||
'compat_BrokenPipeError',
|
||||
'compat_HTMLParseError',
|
||||
'compat_HTMLParser',
|
||||
'compat_HTTPError',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue