From 1c93e019f098d5a4973ff4e4b6f60851b79d6f2a Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Sun, 10 Dec 2017 18:43:18 +0200 Subject: [PATCH] downloaders.py: Ignore negative return codes Fixes: b2fcc5e54661d9c7525d273c036ad5dd4cedf47c Related to: #244 --- youtube_dl_gui/downloaders.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/youtube_dl_gui/downloaders.py b/youtube_dl_gui/downloaders.py index 383a212..c41e4c6 100644 --- a/youtube_dl_gui/downloaders.py +++ b/youtube_dl_gui/downloaders.py @@ -187,14 +187,16 @@ class YoutubeDLDownloader(object): self._set_returncode(self.ERROR) # Set return code to ERROR if we could not start the download process - # or the childs return code is not equal to zero + # or the childs return code is greater than zero # NOTE: In Linux if the called script is just empty Python exits # normally (ret=0), so we cant detect this or similar cases # using the code below - if self._proc is None or self._proc.returncode: + # NOTE: In Unix a negative return code (-N) indicates that the child + # was terminated by signal N (e.g. -9 = SIGKILL) + if self._proc is None or self._proc.returncode > 0: self._return_code = self.ERROR - if self._proc is not None and self._proc.returncode: + if self._proc is not None and self._proc.returncode > 0: self._log('Child process exited with non-zero code: {}'.format(self._proc.returncode)) self._last_data_hook()