Handle BrokenPipeError
PR: https://github.com/ytdl-org/youtube-dl/pull/29505 Fixes: https://github.com/ytdl-org/youtube-dl/issues/29082 Authored by: kikuyan
This commit is contained in:
parent
89efdc15dd
commit
cc3fa8d39d
1 changed files with 5 additions and 0 deletions
|
@ -734,6 +734,11 @@ def main(argv=None):
|
||||||
sys.exit('ERROR: fixed output name but more than one file to download')
|
sys.exit('ERROR: fixed output name but more than one file to download')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit('\nERROR: Interrupted by user')
|
sys.exit('\nERROR: Interrupted by user')
|
||||||
|
except BrokenPipeError:
|
||||||
|
# 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(r'\nERROR: {err}')
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']
|
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']
|
||||||
|
|
Loading…
Reference in a new issue